Now I understand. You wanted to search a text box when certain criteria is passed. You can also do the same with the following -
Option Explicit
Private Declare Function SendMessage Lib "User32" _
Alias "SendMessageA" (byval _
hWnd as Long, _
byval wMsg as Integer, _
byval wParam as string, _
lParam as Any) as Long
Const LB_FINDSTRING = &H18F
Private Sub Form_Load()
With List1
.Clear
.AddItem "18.5" 'or whatever you would like to add, whether from a file or database...
End With
End Sub
Private Sub Text1_Change()
List1.ListIndex = SendMessage(List1.hWnd, LB_FINDSTRING, _
Text1, byval Text1.Text)
End Sub
Note that 'Sendmessage' generates errors in Vista....
Reputation Points: 329
Solved Threads: 347
Senior Poster
Offline 3,700 posts
since Jan 2008