Results 1 to 4 of 4

Thread: listbox

  1. #1
    Guest
    i have a text box and a list box, as i type in the text box, it scrolls to the specific letter in the list box.
    when the letter is found, i set the focus to the list box. how can i do something like, i keep typing in the text box and the up and down arrow keys also work in the list box.
    presently i've trapped the keyup event of list box.

    thanx

  2. #2
    PowerPoster Lethal's Avatar
    Join Date
    Oct 2000
    Location
    Ohio
    Posts
    2,496
    Why not use a combo box?? Set the the matching property to style 2

  3. #3
    Guest
    there's no matching property in combo box, what setting i've to make in combo box, to make it look like a list box, something like the help interface

  4. #4
    Guest
    Try this:

    Code:
    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 Text1_Change()
    
        List1.ListIndex = SendMessage(List1.hWnd, _
        LB_FINDSTRING, -1, ByVal Text1.Text)
    
    End Sub
    If you'd prefer to find the item as you type it in and move it to the top of the list:

    Code:
    Private Sub Text1_Change()
    
        On Error Resume Next
        List1.ListIndex = SendMessage(List1.hwnd, _
        LB_FINDSTRING, -1, ByVal Text1.Text)
        List1.TopIndex = List1.ListIndex - 1
    
    End Sub

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