Solved

Multiple columns ComboBox and ListBox

Posted on 1998-04-13
7
315 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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

746 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now