Hello

I'm writing my first ever VB program. I'm using 2 combo boxes to allow the user to select 2 different pieces of information. Is there any way that I can make my program automaticaly open the first combo box up at startup so the user can easily see what they should be doing. At the moment at startup both combo boxes look like empty text boxes until the user clicks on one of them and then the box opens up. I would like to remove the need to click on the first box at startup.

Thanks you you help

Simon

you could use a listbox instead.

As suggested a list box would be a better option .
or
set the listindex property of the combobox to 0 (zero) so the first item in the list becomes the default choice even if user does not select anything.

you could use a listbox instead.

year i tried that but I prefer the way the Combo box looks and works to the List Box.

what bout setting the listindex to zero.

what bout setting the listindex to zero.

That works but ut would be nice to be able to have the list box pulled down so that it draws the attention of the user to the box so they know that they need to select an item from the list.

Set item 0 to "Please select an item" and the listindex to 0.

commented: Good one wayne. +4

Set item 0 to "Please select an item" and the listindex to 0.

Great Idea :-) Thanks

Simon

Hi,

Wrie this code in Got focus event of combo box:

PrivateSub ComboBox1_GotFocus(ByVal sender AsObject, ByVal e As System.EventArgs) Handles ComboBox1.GotFocus
SendKeys.Send("%{down}")
End Sub

This will open up the drop down list

Regards
Veena

Hi,

Wrie this code in Got focus event of combo box:

PrivateSub ComboBox1_GotFocus(ByVal sender AsObject, ByVal e As System.EventArgs) Handles ComboBox1.GotFocus
SendKeys.Send("%{down}")
End Sub

This will open up the drop down list

Regards
Veena

sending %{DOWN} which I think is sending Alt + the down arrow key does not seem to do anything. Lucky all the items in my selection box all start with an open bracket so by sending that it opens up the box for me. I can see why %{DOWN} should work but I cant get it to work :(

Hi,

To open the dropdown list you can use the next code:

comboBox1.DroppedDown = True

or

comboBox1.DroppedDown = false , to close

see you

Hi,

To open the dropdown list you can use the next code:

comboBox1.DroppedDown = True

or

comboBox1.DroppedDown = false , to close

see you

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.