ComboBox DroppedDown questions

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Paul

    #1

    ComboBox DroppedDown questions

    VB.NET 2003. I am loading a dialog box form with a ComboBox. I'm
    using a DropDownStyle of "DropDown" rather than "DropDownLi st". I
    want them to be able to type in it fill in as they type. The ComboBox
    contains a list of cities. The form will receive a parameter of one
    alpha-numeric character.

    I want to do two things (that I don't know how to do):

    1. The parameter received to be moved to the ComboBox and the cursor
    to be positioned
    at the end of the character. So they can continue to type and
    have the city filled in.
    I can get the ComboBox.Text to be the value of the parameter.
    But the field is selected.
    I cannot get it unselected. So they have the type the character
    a second time.

    2. The list box part of the ComboBox dropped down. I can get it to
    drop down. But the
    list box part then goes back up. I'm guessing it is because the
    form is loading. I've tried
    putting the code in the Form Activated event, but that didn't
    help.

    Any suggestions?

  • ClayB

    #2
    Re: ComboBox DroppedDown questions

    Try this code.

    Private Sub Form2_Load(ByVa l sender As System.Object, ByVal e As
    System.EventArg s) Handles MyBase.Load
    Me.ComboBox1.Dr oppedDown = True
    Me.ComboBox1.Te xt = ""
    Me.ComboBox1.Fo cus()
    SendKeys.Send(" S") 'set an S into the combobox
    End Sub

    =============== ==
    Clay Burch
    Syncfusion, Inc.

    Comment

    • Paul

      #3
      Re: ComboBox DroppedDown questions

      Thanks Clay. I had thought of that too, but wanted to avoid it. I
      don't like using the SendKeys command. You can never really know how
      the keys are going to be sent. But it did work and I'm going with it
      for now.

      Comment

      Working...