Hi,
I have a combo box where I populate manually from the database and using datareader.
From memory, in VB6 you could add the display value and the actual value, but in .NET there is not this option?
Anyway to get around this?
Thanks.
Printable View
Hi,
I have a combo box where I populate manually from the database and using datareader.
From memory, in VB6 you could add the display value and the actual value, but in .NET there is not this option?
Anyway to get around this?
Thanks.
Don't populate the ComboBox manually from the DataReader. Use the DataReader to populate a DataTable and then bind that to the ComboBox. Problem solved.vb.net Code:
Dim table As New DataTable table.Load(reader) reader.Close() myComboBox.DisplayMember = "Name" myComboBox.ValueMember = "ID" myComboBox.DataSource = table
Legend. Worked a treat. Thanks for that, and thank you for the quick response. :D