Combination of textbox and listbox in VB 6

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Mohan Krishna
    New Member
    • Oct 2007
    • 115

    Combination of textbox and listbox in VB 6

    Hi Everyone,

    I'm working with a project, in which i used a listbox and textbox as a combination. Hoping anyone would help me, i explianed my problem:-

    There is a list of companies (sorted or not) in a listbox. While typing in textbox, as per each letter is being typed, the company names in the list MUST BE SELECTED.
    For eg:
    In Textbox In Listbox
    M List starting with M should be selected.
    Mi List starting with Mi should be selected.
    Mic List starting with Mic should be selected.
    Micr List starting with Micr should be selected.
    and so on. If no list with starting letter is found, the very first item in the list should be shown.

    I hope i explained my problem clearly. If there is a solution for this already. I'm sorry to ask it again. But, as I could not find after severl searches, I post this question.

    TIA
  • QVeen72
    Recognized Expert Top Contributor
    • Oct 2006
    • 1445

    #2
    Hi,

    Write this in Change Event of TextBox:
    Make the property of ListBox :
    Sorted = True


    [code=vb]
    List1.Text = Text1.Text
    If List1.SelCount = 0 Then List1.Selected( 0) =True
    [/code]

    REgards
    Veena

    Comment

    • Mohan Krishna
      New Member
      • Oct 2007
      • 115

      #3
      Originally posted by QVeen72
      Hi,

      Write this in Change Event of TextBox:
      Make the property of ListBox :
      Sorted = True

      Veena
      Hi Veena,

      Thank You for a quick and helpful reply.

      Can't we extend the list for all the items starting with the letter(s) while we type in?

      Thank you once again!

      WIth regards,
      Mohan

      Comment

      • QVeen72
        Recognized Expert Top Contributor
        • Oct 2006
        • 1445

        #4
        Hi,

        Instead of allowing to Type in textBox, and show the list, Make ListBox's Property Sorted = True and Set Focus to ListBox.. When user types first few letters, Matching List Item will be highlighted..

        Regards
        Veena

        Comment

        • Mohan Krishna
          New Member
          • Oct 2007
          • 115

          #5
          Originally posted by QVeen72
          Hi,

          Instead of allowing to Type in textBox, and show the list, Make ListBox's Property Sorted = True and Set Focus to ListBox.. When user types first few letters, Matching List Item will be highlighted..

          Regards
          Veena

          Thank u very much!

          Can't we try like this in VB 6?



          TIA

          Comment

          Working...