I'm using a DataReader to populate a combo box. Its simple enough -
VB Code:
Dim clsDB As New DBClass Dim dr As SqlDataReader clsDB.ConnString = ConfigurationSettings.AppSettings("ConnString") clsDB.SPName = "mmu_Select_ChangeCodes" dr = clsDB.GetDR Do While dr.Read() Me.cboChangeCode.Items.Add(dr.Item("change_code_desc")) Loop dr.Close()
The problem with doing it this way is I cant set a Value member.
If I bind the Datareader to the control via
VB Code:
Me.cboChangeCode.DataSource = dr Me.cboChangeCode.DisplayMember = "change_code_desc" Me.cboChangeCode.ValueMember = "change_code"
I get the following error, "Additional information: Complex DataBinding accepts as a data source either an IList or an IListSource"
The goal i need is to have index value and a display value on each combo box.
This was so much simpler in vb6.....




Reply With Quote