Thursday, June 30, 2011

How to search in List box when use Text box

  

Use this API in Modual 


Public Declare Function SendMessage Lib "user32" Alias "SendMessageA"  _
(ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As String, lParam As Any) As Long

Global Const LB_FINDSTRING = &H18F

Use in Form

Private Sub Text1_Change()
On Error Resume Next

List1.ListIndex = SendMessage(List1.hWnd, LB_FINDSTRING, Text1, ByVal Text1.Text)

End Sub
 

1 comment: