Combo box, multiple display members (1 Viewer)

GST

New member
Local time
Today, 11:48
Joined
Apr 14, 2003
Messages
9
How do I display multiple fields in a combo box.:confused: For instance for selecting employees:

Empl# I LName I FName
12345 I Jones I John
12346 I Smith I James
12347 I Clark I Larry
12348 I Leigh I Susan

I am just learning VB.NET.
Was using Access and VBA which was very simple to do this by including multiple fields in properties values or using a wizard.

Thanks for your patience and understanding.
 

boblarson

Smeghead
Local time
Today, 09:48
Joined
Jan 12, 2001
Messages
32,059
You can create a combo box by using the wizard (which should help) or if you already have one, you can go into it's properties, set the rowsource to a query (selecting the fields you want), and then change the property:
Column Count (put in the number of columns in your query)
Bound Column (put the number of the column you want to be used for the combo's value)
Column Widths (put in the widths, separated by a semi-colon ; so for example, if I want the bound column to be the first column then I set the bound column to 1. If I have 3 columns in my query and I want to show the 2nd and 3rd, but not the first, then I would type in the Column Width property:
0";1";1"
changing the 1" to whatever works for my situation.
 

GST

New member
Local time
Today, 11:48
Joined
Apr 14, 2003
Messages
9
Bob,

Thanks for the help, that's exactly what I was trying to do.

Once again thanks, and Merry Christmas.

Gary
 

skea

Registered User.
Local time
Today, 19:48
Joined
Dec 21, 2004
Messages
342
In case you dont use a Wizard....or you think of late-binding then you will probably you will need to put your objects in an array or collection and assign that to the DataSource of the ComboBox. You then set the DisplayMember and ValueMember properties of the ComboBox to the names of the visible and hidden property respectively.
 

Users who are viewing this thread

Top Bottom