VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



ever wanted to search a listbox while typing in a textbox? kinda like Microsoft help style?

by C (2 Submissions)
Category: Databases/Data Access/DAO/ADO
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Mon 25th April 2005
Date Added: Mon 8th February 2021
Rating: (1 Votes)

ever wanted to search a listbox while typing in a textbox? kinda like Microsoft help style?

Rate ever wanted to search a listbox while typing in a textbox? kinda like Microsoft help style?



               'email me for any comment   '
               '[email protected] ' 


option Explicit
private Declare Function SendMessage Lib "User32" _
        Alias "SendMessageA" (byval _
        hWnd as Long, _
        byval wMsg as Integer, _
        byval wParam as string, _
        lParam as Any) as Long

Const LB_FINDSTRING = &H18F

private Sub Form_Load()

    With List1
        .Clear
        .AddItem "RAM"
        .AddItem "rams"
        .AddItem "RAMBO"
        .AddItem "ROM"
        .AddItem "Roma"
        .AddItem "Rome"
        .AddItem "Rommel"
        .AddItem "Cache"
        .AddItem "Cash"
    End With

End Sub

private Sub Text1_Change()
    List1.ListIndex = SendMessage(List1.hWnd, LB_FINDSTRING, _
                      Text1, byval Text1.Text)
End Sub


Download this snippet    Add to My Saved Code

ever wanted to search a listbox while typing in a textbox? kinda like Microsoft help style? Comments

No comments have been posted about ever wanted to search a listbox while typing in a textbox? kinda like Microsoft help style?. Why not be the first to post a comment about ever wanted to search a listbox while typing in a textbox? kinda like Microsoft help style?.

Post your comment

Subject:
Message:
0/1000 characters