CodeItBetter Programming Another VB Programming Blog

How to scan List Box for the text in TextBox

Posted on January 5, 2009
1
2
3
4
5
6
7
8
9
10
11
12
13
14
'Controls - How to scan List Box for the text in TextBox

Option Explicit
 
'Add a Text Box and a List Box to your form and add few items to the List Box.
'If you will type 'a' in the Text Box, the first item beginning with 'a' will be selected.

Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, _
    ByVal wParam As Integer, ByVal lParam As Any) As Long
Public Const LB_FINDSTRING = &H18F
 
Private Sub Text1_Change()
    List1.ListIndex = SendMessage(List1.hwnd, LB_FINDSTRING, -1, ByVal CStr(Text1.Text))
End Sub
Filed under: Controls Leave a comment
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


 

No trackbacks yet.