Search a ListBox Control Quickly Using API Call
Search a ListBox Control Quickly Using API Call
API Declarations
Private Declare Function SendMessage Lib "User32" _
Alias "SendMessageA" _
(ByVal hWnd As Long, _
ByVal wMsg As Integer, _
ByVal wParam As Integer, _
lParam As Any) As Long
Rate Search a ListBox Control Quickly Using API Call
(2(2 Vote))
Private Sub Text1_Change()
List1.ListIndex = SendMessage(List1.hWnd, LB_FINDSTRING, -1, _
ByVal Text1.Text)
End Sub
'
'If you like that the found item list stays next to top of the ListBox control,
'you can try this:
Private Sub Text1_Change()
'
On Error Resume Next
'
List1.ListIndex = SendMessage(List1.hwnd, LB_FINDSTRING, -1, _
ByVal Text1.Text)
'
List1.TopIndex = List1.ListIndex - 1
'
End Sub
Search a ListBox Control Quickly Using API Call Comments
No comments yet — be the first to post one!
Post a Comment