Not all that many ways to go:VB Code:
Dim strText As String, lngA As Long ' store into temporary string variable for faster access strText = Text1.Text ' loop! For lngA = 0 To List1.ListCount - 1 If InStr(strText, List1.List(lngA), vbTextCompare) > 0 Then MsgBox "Found!" Exit For End If Next lngA If lngA = List1.ListCount Then MsgBox "Not found!"
Shuja Ali: you shouldn't use $ character within InStr, because the return value is a Long and if you use $, the return value is first converted to a string and then to something else for numeric comparison.




Reply With Quote