SearchListBox (3)



Option Explicit
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
Const LB_FINDSTRING = &H18F
Private Sub Command1_Click()
End
End Sub
'_________________________________________________________


Private Sub Form_Load()
With List1
.Clear
.AddItem "CPU"
.AddItem "RAM"
.AddItem "ROM"
.AddItem "Cache"
.AddItem "Motherboard"
.AddItem "Hard Disk"
.AddItem "Floppy Disk"
End With
End Sub
'_________________________________________________________


Private Sub Text1_Change()
List1.ListIndex = SendMessage(List1.hWnd, LB_FINDSTRING, -1, _
ByVal Text1.Text)
Text1.Text = List1.Text
End Sub
'_________________________________________________________


'Eseguite il progetto (F5) e scrivete del testo nella text box,

'e se coincide con il testo nella listbox, verra' mostrato nella

'text box.

'Potete fare questo con tutti i controlli, come una combo box,

'che vi permettono di scrivere del testo ed hanno una proprieta'

'di testo.


(searchlistbox3.html)- by Paolo Puglisi - Modifica del 25/3/2019