Reputation: 1552
This is an old Vb6 application I'm working on - and I'm having somewhat of a hard time of setting a value to a combobox.
I first load the data to combobox - mind you - I'm only setting the text values in the combobox, no ID's. Here's what the code looks like...
Dim z As Integer
Dim a As Integer
oCombobox.Clear
oCombobox.AddItem "", 0
Call GetValuesForCbo
Do While Rs.EOF = False
z = z + 1
oCombobox.AddItem "", z
For a = 0 To oCombobox.ColumnCount - 1
oCombobox.List(z, a) = Rs.Fields(a).Value
Next
Rs.MoveNext
Loop
So what happens is I have this function where I pass a ComboxName aka oCombobox. In CallValuesForCBO I query the database to get the values.
The values are definitely there because I don't get an error when i do this...
m_stringValue = 'Hello' <--this is one of the values I load into combobox
cboName.Value = m_stringValue <-- while this does not throw an error, it does not display any value in the cbo
Upvotes: 0
Views: 173