Hello,
I'm new with VB.net and I've found a code that I use to do a SQL query on ACCESSDB and it return me a datagrid. For Exemple, I do a query on my tbl_person :
"SELECT id_person, person_name, person_birthdate FROM tbl_person"
After that, I want to show this result in a combox box, but I don't find how to have 3 columns (id, name and birthdate) with the id hidden. Usually, I work with Access forms, but I want learn vb.net.
How can I do my combobox with 3 columns and with my first column hidded
Thanx for you help
// I'm not english, so sorry for my errors

[VB.NET VS2005] Multicolumn combobox
Jompe
Dr. Pastor.
Isn't there an auto complete combo box now, where you can type and get a list of possible matches OR is it an auto complete text box only
LazyCat
kablou
Build a dictionary mapping names to IDs, then use that to look up.
robbyd
aghiondea
http://www.codeproject.com/vb/net/MultiColumnFlatCombo.asp
try this. This is vs2003 version, you might have to convert to vs2005.
i use this control before, it was quite stable. But bear in mind if you have more than 20 columns display, you might have slow down the paint event.
currently this combobox only support up to 4 column, to have more, you might need to add it urself in the coding.
Renzo Ruiz
You could also do this:
"SELECT id_person, person_name + ' ' + CAST(person_birthdate AS VARCHAR) AS 'ShowValue' FROM tbl_person"
Then (assuming the query above is executed using an object called objDataSource, and that you are loading a combo box control called cboDisplay):
With cboDisplay.DataSource = objDataSource
.DisplayMember = "ShowValue"
.ValueMember = "id_Person"
End WithFinally, to figure out which id the user actually selected:
Private Sub cboDisplay_SelectionChangeCommitted(ByVal sender As Object, ByVal e As System.EventArgs) Handles cboDisplay.SelectionChangeCommitted Dim SelectedID As String = cboDisplay.SelectedValue End SubRichard Chauvet
1 - if they have the same name, how will you tell them apart using your method You need to build strings that uniquely identify them anyhow, if your users are to be able to select the one they want
2 - yes, you could write your own control, and have it behave however you like.
Niklas
Yes but on my program the user have to select a person in a list of 2000 people.
What's the best thing I can do for the user
Ricardo_medina
Alistair_2005
Is there not a "official" method But thanks for the multi column combo