• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 329
  • Last Modified:

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

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.

-Bob
0
bobcann
Asked:
bobcann
3 Solutions
 
MattiCommented:
Hi!
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
            ListBox1.Items.Add(Str(i))
        Next
    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
0
 
CodeCruiserCommented:
>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?
0
 
omegaomegaDeveloperCommented:
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.)

Cheers,
Randy
0
 
bobcannAuthor Commented:
Thanks Guys!
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now