Results 1 to 3 of 3

Thread: ComboBox Auto Open

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Apr 2005
    Location
    Debug.Print
    Posts
    3,885

    ComboBox Auto Open

    Hi all:

    I have been searching for a while and not able to find anything useful on how to approach this issue.

    I have a ComboBox on a form and what I am looking to do is when the ComboBox has the cursor focus, it automatically opens up and displays the options. Just as if you clicked on the ComboBox. I was considering PerformClick but the only problem is, I believe PerformClick is only available for the Button and no other control.

    Any ideas? Thanks in advance!

  2. #2
    Fanatic Member Satal Keto's Avatar
    Join Date
    Dec 2005
    Location
    Me.Location
    Posts
    518

    Re: ComboBox Auto Open

    If I am understanding you correctly the following code should do what you want.

    Code:
        Private Sub ComboBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.Click
            ComboBox1.DroppedDown = True
        End Sub
    Hope this helps

    Satal

  3. #3
    Wait... what? weirddemon's Avatar
    Join Date
    Jan 2009
    Location
    USA
    Posts
    3,826

    Re: ComboBox Auto Open

    Cursor focus could mean one of two things. It could mean when clicked and if that's the case, Satal example works just fine. But it could also me when it has focus, like it was tabbed to. And in that case, the enter event should do.

    vb Code:
    1. Private Sub ComboBox1_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.Enter
    2.         ComboBox1.DroppedDown = True
    3.     End Sub
    CodeBank contributions: Process Manager, Temp File Cleaner

    Quote Originally Posted by SJWhiteley
    "game trainer" is the same as calling the act of robbing a bank "wealth redistribution"....

Posting Permissions

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



Click Here to Expand Forum to Full Width