GenieTR
IS-IT--Management
- Jan 21, 2003
- 28
I have a list box and a text box on a form. The form loads the list box from a table and the text box is used for searching the list box. The code for the text box search is:
On the Change event property:
Private Sub SearchActorTxt_Change()
Dim s as string
Dim i as integer
s = SearchActorTxt.Text
LstAvailable.ListIndex = -1
If SearchActorTxt.Text = " " then
exit sub
end if
For i = 0 to LstAvailable.ListCount - 1
If UCase(LstAvailable.ItemData(i)) Like UCase(s & "*") Then
LstAvailable.ListIndex = i
Exit Sub
end if
Next
end Sub
I am getting a "run-time error 7777" "you're used ListIndex property incorrectly"
The line in question is LstAvailable.ListIndex = -1
can you explain what I am doing wrong.
Thanks in advance
On the Change event property:
Private Sub SearchActorTxt_Change()
Dim s as string
Dim i as integer
s = SearchActorTxt.Text
LstAvailable.ListIndex = -1
If SearchActorTxt.Text = " " then
exit sub
end if
For i = 0 to LstAvailable.ListCount - 1
If UCase(LstAvailable.ItemData(i)) Like UCase(s & "*") Then
LstAvailable.ListIndex = i
Exit Sub
end if
Next
end Sub
I am getting a "run-time error 7777" "you're used ListIndex property incorrectly"
The line in question is LstAvailable.ListIndex = -1
can you explain what I am doing wrong.
Thanks in advance