Results 1 to 3 of 3

Thread: Linking a text box to a list box

  1. #1

    Thread Starter
    Hyperactive Member Gimpster's Avatar
    Join Date
    Oct 1999
    Location
    Redmond, WA 98052
    Posts
    331

    Post

    I would like to create a list box similar to those in help files where you have a list of all available topics, and then you have a text box at the top, and as you type it highlights any matching entries. How would you do this? Please give code, if you can. Thank you.

    ------------------
    Ryan
    corneslen@hotmail.com
    ICQ# 47799046


    [This message has been edited by Gimpster (edited 11-05-1999).]

  2. #2
    Guru Yonatan's Avatar
    Join Date
    Apr 1999
    Location
    Israel
    Posts
    892

    Post

    There's a function which does this which is built into the ListBox. Unfortunately, it isn't built into the Visual Basic ListBox. But you can still use it, indirectly:

    Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long

    Private Const LB_FINDSTRING = &H18F

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


    ------------------
    Yonatan
    Teenage Programmer
    E-Mail: RZvika@netvision.net.il
    ICQ: 19552879


    [This message has been edited by Yonatan (edited 11-05-1999).]

  3. #3

    Thread Starter
    Hyperactive Member Gimpster's Avatar
    Join Date
    Oct 1999
    Location
    Redmond, WA 98052
    Posts
    331

    Post

    Thanks, it works great!

    ------------------
    Ryan
    corneslen@hotmail.com
    ICQ# 47799046

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width