Make your own free website on Tripod.com

Scan ListBox For The Text In TextBox

'Add a module to your project (In the menu choose Project -> Add Module, Then click Open)
'Add 1 Text Box and 1 List Box to your form. Add few items to the List Box.
'If you will type 'a' in the Text Box, the first item beginning with 'a' will be marked.
'Insert this code to the module :

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

'Insert this code to your form:

Private Sub Text1_Change()
List1.ListIndex = SendMessage(List1.hwnd, LB_FINDSTRING, -1, ByVal CStr(Text1.Text))
End Sub

Go Back