Article ID: 141027
Article Last Modified on 3/14/2005
SendMessage (hWnd,LB_FINDSTRING, wParam, lparam)where:
hWnd is the hWnd of the list box.
wParam is an integer 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.
#If Win32 Then
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
#Else
Declare Function SendMessage Lib "user" (ByVal hwnd As Integer, _
ByVal wMsg As Integer, ByVal wp As Integer, lp As Any) As Long
#End If
Public Const LB_FINDSTRING = &H18F
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
Additional query words: 4.00 vb4win vb4all
Keywords: kbhowto kbcode KB141027