Results 1 to 3 of 3

Thread: List box problem

  1. #1

    Thread Starter
    Member
    Join Date
    Nov 2002
    Location
    Bangladesh
    Posts
    48

    List box problem

    Can any body help me?

    As I begin to write in a text box - the list box will show rearranging it items bring the items first those items matching the characters I am typing in the text box.

    It should work as like MSDN index option.


    Please help it urgent

  2. #2
    Hyperactive Member
    Join Date
    Jun 2002
    Posts
    299
    hmm... i'd reccomend on the keypress event, having it loop through all the elements in the listbox and see if what you've entered matches. if it does, move it to the top. something like
    VB Code:
    1. Sub Text1_KeyPress(KeyAscii as Integer)
    2.     For c = 0 to List1.ListCount 'i forget if this is the right property, but you know what i mean
    3.     If Text1.Text = Mid(List1.List(c),1,len(Text1.text)) Then
    4.         str1=List1.List(0)
    5.         str2=List1.List(c)
    6.         List1.List(0)=str2
    7.         List1.List(c)=str1
    8.     End If
    9.     Next c
    10. End Sub
    If I agree with you today, don't get used to it.

  3. #3
    Lively Member
    Join Date
    Jan 1999
    Location
    Burlington, IA, USA`
    Posts
    77
    'use sendmessage API

    Private Sub Text1_Change()
    List1.ListIndex = SendMessage(List1.hWnd, _
    LB_FINDSTRING, -1, ByVal Text1.Text)
    End Sub
    An ass may bray a good long time before he shakes the stars down.
    T.S. Elliot

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