Article ID: 161161
Article Last Modified on 2/24/2005
SendMessage(hWnd, LB_FINDSTRING, wParam, lParam) where
hWnd - is the hWnd of the list box.
wParam - is a long that specifies the starting point for the
search. Use -1 to search the whole list box.
lParam - is a long pointer to the string to find.
Const LB_FINDSTRING = &H18F
Private Declare Function SendMessage Lib "User32" _
Alias "SendMessageA" _
(ByVal hWnd As Long, _
ByVal wMsg As Integer, _
ByVal wParam As Integer, _
lParam As Any) As Long
Private Sub Form_Load()
List1.Clear
List1.AddItem "Apples"
List1.AddItem "Banana"
List1.AddItem "Bread"
List1.AddItem "Break"
Text1.Text = ""
End Sub
Private Sub Text1_Change()
List1.ListIndex = SendMessage(List1.hWnd, LB_FINDSTRING, -1, _
ByVal Text1.Text)
End Sub
Keywords: kbhowto kbapi KB161161