Selecting an item in a combobox by typing a letter

  1. 4 days ago

    Armando S

    Jun 29 Parma, Italy

    I have a ComboBox with just 2 items: North and South.
    How can I select either item by just typing N or S (wether in capital or small letter?
    Every time I do it I get an extra letter, i.e. nNorth or sSouth. I need to intercept the extra s or n.

    Thank you

  2. Dale A

    Jun 29 San Diego, California, USA

    This is really a bad example but the following code in the TextChanged event will do it, assuming "North" is listed first.

    If Me.value.length = 1 Then
      If Me.Value.LowerCase = "n" Then Me.SelectedRowIndex = 0
      If Me.Value.LowerCase = "s" Then Me.SelectedRowIndex = 1
    End If
  3. Emile S

    Jun 29 Europe (France, Strasbourg)

    @Armando S ComboBox

    Why don’t you use a PopupMenu instead ?

  4. Armando S

    Jun 30 Parma, Italy

    My mistake. It is a PopupMenu. The solution suggested by Dale, will it work?

  5. 3 days ago

    Ramon S

    Jul 1 Testers, Xojo Pro UPC, Europe (Barcelona, Spain)

    Most probably you should use the KeyDown event of the PopupMenu

or Sign Up to reply!