Sungguh tidak mungkin jika kita akan mencari satu per satu dari data tersebut ..
lalu bagaimana pencarian data dalam listbox ???
chekidot . !!!
' Deklarasi
Private Declare Function SendMessageByString Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long
Private Const LB_SELECTSTRING = &H18C
Private Sub Command1_Click()
Text1.Text = List1.Text
MsgBox "You selected " & vbCrLf _
& Text1.Text
Text1.SetFocus
End Sub
' ini bagian terpenting untuk pencarian data di listbox
Private Sub Text1_Change()
Dim lngEntryNum As Long
Dim strTextToFind As String
strTextToFind = Text1.Text
lngEntryNum = SendMessageByString(List1.hwnd, LB_SELECTSTRING,0,strTextToFind)
End Sub
Contoh Program ..
Tidak ada komentar:
Posting Komentar