Results 1 to 2 of 2
  1. #1
    New Lounger
    Join Date
    Oct 2001
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    ComboBox (VNBVB6)

    I have created a combo box on a form and set the style to 2 (I want the user to select from the list). I am trying to trap an event when a choice is selected, either by the user or programatically.

    I like the look of a drop down box, so I don't want to use a list box that scrolls and I don't want to set styles 0 or 1, because the user could change the selections.

    The lostfocus event works OK for user changes but no progamatic changes.

    1. Any suggestions on a better control?
    2. Any suggestions on how to trap the event?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: ComboBox (VNBVB6)

    You might call the LostFocus routine whenever you change the value of the combo box in code, like in this example:

    Private Sub Command1_Click()
    Combo1 = "MyValue"
    Combo1_LostFocus
    End Sub

    Note: in this example, if the focus was on the combo box, and the user clicks the command button, the LostFocus event routine will be called twice. If this is a problem, you can use a global variable to prevent this.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •