You can use a simple SendMessage API to achiev exactly what you want. Let's assume that you have a ListBox and a TextBox where you type in your search text:
When you type into the Textbox, it will search the Listbox for the string you typed in. If it finds it, then it will select that list item.Code:Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long Private Const LB_FINDSTRING = &H18F Private Sub Text1_Change() List1.ListIndex = SendMessage(List1.hwnd, LB_FINDSTRING, -1, ByVal (Text1.Text)) End Sub




Reply With Quote