|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
Combo Boxes in VB.Net
Does anyone know if combo boxes in VB.Net are allowed to have multiple columns?
I know they could in VB6, but I cannot find a way to bind to one column, while displaying another. (see below code example... this snippet used only for binding) -------------------------------------------------------------------- 'Bind the combo box to the data. cmbProblems.DataSource = DS.Tables(0) cmbProblems.DisplayMember = "description" ------------------------------------------------------------------- The DS above refers to my dataset, and as I am using only one table, I left assigned the index to zero. I would like to be able to display two columns from the same table (actually I would like to bind on the ID column, while displaying the description column). Any Ideas? |
|
#2
|
|||
|
|||
|
When you use a combo box like this then each item is actually a DataRowView item.
So, you can pull out the select Item using datarowview("columnname").... ' Definitions Dim drv as DataRowView Dim ID as Int32 Dim Description as String ' Get the Selected Item drv = ComboBox.SelectedItem ' Get the Values ID = drv("id") Description = drv("description") |
![]() |
| Viewing: ASP Free Forums > Programming > Visual Basic Programming > Combo Boxes in VB.Net |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|