Quickly Search a List Box. A popular item in a user interface is to link a text box to a list box
Quickly Search a List Box. A popular item in a user interface is to "link" a text box to a list box so that as the user types text into the
API Declarations
Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
(ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As _
Integer, ByVal lParam As Any) As Long
Public Const LB_FINDSTRING = &H18F
Rate Quickly Search a List Box. A popular item in a user interface is to link a text box to a list box
(2(2 Vote))
'2) Add the code below to the form
'3) If you run the code, typing text into the text box selects the first item in the list that matches the text in the text box.
Sub Form_Load()
List1.Clear
List1.AddItem "Apples"
List1.AddItem "Banana"
List1.AddItem "Bread"
List1.AddItem "Break"
End Sub
Sub Text1_Change()
List1.ListIndex = SendMessage(List1.hwnd, LB_FINDSTRING, -1, _
ByVal CStr(Text1.Text))
End Sub
Quickly Search a List Box. A popular item in a user interface is to link a text box to a list box Comments
No comments yet — be the first to post one!
Post a Comment