本文介绍了如何查看组合框的listindex?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在这里加载组合框的值........
我不想将listindex属性设置为-1
I load values of combo boxes here........
I dont want to set listindex property to -1
Private Sub Form_Load()
OPENCON
RES.Open "DIVISION", CON, adOpenDynamic, adLockOptimistic, adCmdTable
If RES.RecordCount > 0 Then
RES.MoveFirst
For i = 0 To RES.RecordCount - 1
CmbDiv.AddItem RES.Fields("DIV").Value
CmbDiv.ItemData(CmbDiv.NewIndex) = RES.Fields("DIVID").Value
RES.MoveNext
Next
End If
RES.Open "HNM", CON, adOpenDynamic, adLockOptimistic, adCmdTable
If RES.RecordCount > 0 Then
RES.MoveFirst
For i = 0 To RES.RecordCount - 1
CmbHouse.AddItem Trim(RES.Fields("HOUSE").Value)
CmbHouse.ItemData(CmbHouse.NewIndex) = RES.Fields("HID").Value
RES.MoveNext
Next
End If
这是我用来修改记录的代码.........
This is the code I used to modify record.........
Private Sub CmdSave_Click()
1. sql = "UPDATE STUDENT_RECORD_DATABASE SET "
2. sql = sql + "ROLLNO= " & Val(CmbRNO) & ","
3. sql = sql + "DIVID='" & Val(CmbDiv.ItemData(CmbDiv.ListIndex)) & "',"
4. sql = sql + "HID=" & Val(CmbHouse.ItemData(CmbHouse.ListIndex)) & " "
5. sql = sql + "WHERE ROLLNO= " & Val(CmbRNO) & ""
Set RES = CON.Execute(sql)
End Sub
运行此代码时如果我修改了分区和房子那么它就可以......
但是当我放任何时候它们中的一个值(没有修改值)它显示错误:
第3行和第4行的无效属性数组值
请help .......
While running this code If I modify both division and house then it''s ok......
but when I let any one value of them(doesn''t modify value) it shows error :
Invalid Property array value at 3rd and 4th line
Please help.......
推荐答案
这篇关于如何查看组合框的listindex?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!