Solved

Multiple columns ComboBox and ListBox

Posted on 1998-04-13
7
319 Views
Last Modified: 2010-08-05
I'm working in vb4. I'm using the Microsoft Forms 2.0 OCX.
I switched a ComboBox to ColumnCount = 2. I'm getting data from a recordset.
How can I do to add items to the first and second columns?
I know how to work with standard ComboBoxes: ComboBox1.AddItem "Hello", but i don't know how to send data to thhe second column, and my help file doesn't work.
How do you work with multiple column comboboxes?
How do you extract items?
Which is the propertie that allows you to do that?
Thanks
Ivan Babic
ibabic@hotmail.com
PD: The same question for ListBoxes, please. I figure out it should be the same, but you never know.
0
Comment
Question by:ibabic
7 Comments
 

Author Comment

by:ibabic
ID: 1461156
Edited text of question
0
 

Expert Comment

by:tapsbin
ID: 1461157
Just wait for few hours...i will answer...

It seems to me that by changing the ColumnCount = 2 ...it is
only a logical second column so that you go on adding items
and it will appear columnwise...

But yes i will clearify you within few hours...

Thanks,

TAPS

0
 
LVL 3

Expert Comment

by:fguerreiro_inix
ID: 1461158
To assign values to an item beyond the first column, use the List or Column property and specify the row and column of the item. I can assign all at a time if do this:
object.additem ValueCol1 & vbtab & ValueCol2 & ......

Extracticon (of the imagelist control) is a method, not a property. You can use it to extract a icon of the imagelist to assign it to a mousepointer for example.
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 

Author Comment

by:ibabic
ID: 1461159
fguerreiro:
I didn't say Extracticon. i said Extract Item from the Combobox or the ListBox.
For example :
If i have this Access TABLE :
     Code                Name
     00001               Ivan Babic
     00002               F. Guerreiro

How can i fill the combo so that any of those values has an exact place in the list? i mean, there should be a propertie in the combobox that lets me extract a value like this:
Msgbox "This is the name : " & ComboBox1(Row(2), Column(2))
and it will show me this :
        This is the name : F. Guerreiro
I don't wanna work anymore with functions like Right(Combobox1,5) in order to get the code of a person. I need to work with column numbers. How can i do it?

Thanks
Ivan Babic
ibabic@hotmail.com
PD : I know how to get the row number back (with listindex). What i need is to get the column number. to use it.
0
 

Expert Comment

by:tapsbin
ID: 1461160
I was confused reagarding the standard combo box and the microsoft forms 2.0 control combo box...

I will have to work it out..Sorry for your waiting...

Thanks,

TAPS

0
 
LVL 5

Accepted Solution

by:
bin_huwairib earned 50 total points
ID: 1461161
ibabic,

AddItem method will add text in the first column only, to use the other columns you must use List property.

Example:

Private Sub Form_Load()
 Dim Index As Integer

 Index = ComboBox1.ListCount
 Call ComboBox1.AddItem("Column1", Index)
 ComboBox1.List(Index, 1) = "Column2"  '1 means the second column
End Sub

You can use the same code for ListBox control.
0
 

Author Comment

by:ibabic
ID: 1461162
bin_huwairib:
I tried what you said, and it works!!!
Now i have another problem.
When i close the project (vb4) and i try to reopen it, it gives me trouble. VB4 tries to open the MsForms 2.0 Combobox as an old one, i mean, as a MsForms 1.0 ComboBox. And of course, it gives me an error like :
Line 218: The Property Size Name of CD_CAMPAÑA is not valid.
Line 220: Couldn't load the Property ColumnCount of CD_CAMPAÑA .
etc...
It's because it's trying to open the combobox as a standard vb4 combo. How can i fix it?
Ivan Babic
ibabic@hotmail.com
PD: Also for ListBoxes
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Macro which automatically send Excel spreadsheet to Outlook problem 2 75
Can we place a tooltip on the actual vb6 form 5 47
vbModal 12 57
Zip Folders Using Chilkat Routines 1 58
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

791 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question