这是我正在研究的旧版Vb6应用程序 - 而且我在为组合框设置值时遇到了一些困难。
我首先将数据加载到组合框 - 请注意 - 我只是在组合框中设置文本值,而不是ID' s。这是代码的样子......
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
所以会发生什么,我有这个功能,我传递一个ComboxName又名oCombobox。在CallValuesForCBO中,我查询数据库以获取值。
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
答案 0 :(得分:2)
VB.ComboBox
没有ColumnCount
属性。