VB List/Combo.

Discussion in 'Visual Basic ( VB )' started by techlearner, Apr 19, 2006.

  1. techlearner

    techlearner New Member

    Joined:
    Apr 6, 2006
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    0
    Hello Guys!!

    I need help with two problems. I hope I am able to explain these well. Listed below:

    1. List Box : I want to drop a particular item which shows on a list box in another label. Now I am able to do this, if the item is selected (meaning it is in blue color on the list). But my software being for non-technical users, I am afraid, it might confuse them because they might think, the item shown on the list is selected and might not click on it to make it blue(or selected), but it wont show on the label. Is there any way I can solve this, maybe make the item showing on the list selected in some way, or use a limit to list kind of combo box, if there is one? I use the list.text property to access to list item and drop in label.
    2. Combo Box: I am used to working with combo in ACCESS and in that, once you start typing anything on the combo, the list starts showing same or related items on top, so you dont have to scroll down what could a very long list to find a particular item. Is there any way I can do that in VB?

    I would appreciate any help or suggestions.
    Thanks in advance
     
    Last edited: Apr 19, 2006
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    Why dont you forcefully make a selection when there is no selection.
    Code:
    If List1.ListIndex = -1 Then
        List1.ListIndex = 0
    End If
    There are more than one way to do this.

    1. You set the combo box style to dropped down and when you have the focus on the combo box just make sure the box has its list expanded and then you will see the selection is done as and when you type in the characters. You need to be handling the minor issues of Tab pressed as well as Enter.
    2. The other way is you have the combo box as Drop down / Simple Combo and then depending on the value in the initialy entered you make fill the next possible characters value and set the selection such that next character is keyed in at the next position. Use the selstart and sel length property to get the desired output.

    Thanks
    Shabbir
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice