How Is a ComboBox List of Items be Displayed Using the MouseDown Event?

Posted on 2011-04-20
Last Modified: 2013-11-05
When a user clicks on the text area of a combo box its item list need to be displaced. The MouseDown events seems to be the way, but I cannot find a method that displays its list of items.

Any advice? Thanks for any help.

Question by:bobcann
    LVL 14

    Assisted Solution

    Very simple!

    Public Class Form1

        Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
            Dim i As Integer
            For i = 1 To 50   ' put some items
        End Sub

        Private Sub ListBox1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles ListBox1.MouseDown
            TextBox1.Text = ListBox1.Text
        End Sub
    End Class
    LVL 83

    Assisted Solution

    >When a user clicks on the text area of a combo box its item list need to be displaced.

    It does display without you having to do anything doesn't it?
    LVL 12

    Accepted Solution

    Hello, bobcann,

    As CodeCruiser says, the behaviour of the ComboBox can be as you want, but you must first set its DropDownStyle property to DropDownList.  (If set to DropDown, clicking in the text area will not cause the list to display.  If set to Simple, the list is always displayed.)


    Author Closing Comment

    Thanks Guys!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Free Trending Threat Insights Every Day

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Article by: jpaulino
    XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String ( Literal, only instead of starting and ending with w…
    Article by: Kraeven
    Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.
    This video discusses moving either the default database or any database to a new volume.

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    8 Experts available now in Live!

    Get 1:1 Help Now