954,224 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Combo Box

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

blondie.simon
Light Poster
27 posts since Jul 2007
Reputation Points: 34
Solved Threads: 0
 

you could use a listbox instead.

waynespangler
Posting Pro in Training
461 posts since Dec 2002
Reputation Points: 84
Solved Threads: 58
 

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.

debasisdas
Posting Genius
6,870 posts since Feb 2007
Reputation Points: 666
Solved Threads: 434
 
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.

blondie.simon
Light Poster
27 posts since Jul 2007
Reputation Points: 34
Solved Threads: 0
 

what bout setting the listindex to zero.

debasisdas
Posting Genius
6,870 posts since Feb 2007
Reputation Points: 666
Solved Threads: 434
 
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.

blondie.simon
Light Poster
27 posts since Jul 2007
Reputation Points: 34
Solved Threads: 0
 

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

waynespangler
Posting Pro in Training
461 posts since Dec 2002
Reputation Points: 84
Solved Threads: 58
 
Set item 0 to "Please select an item" and the listindex to 0.


Great Idea :-) Thanks

Simon

blondie.simon
Light Poster
27 posts since Jul 2007
Reputation Points: 34
Solved Threads: 0
 

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

QVeen72
Posting Shark
950 posts since Nov 2006
Reputation Points: 84
Solved Threads: 143
 

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 :(

blondie.simon
Light Poster
27 posts since Jul 2007
Reputation Points: 34
Solved Threads: 0
 

Hi,

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

comboBox1.DroppedDown = True

or

comboBox1.DroppedDown = false , to close

see you

issac.pena
Newbie Poster
2 posts since Jun 2008
Reputation Points: 10
Solved Threads: 0
 

Hi,

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

comboBox1.DroppedDown = True

or

comboBox1.DroppedDown = false , to close

see you

issac.pena
Newbie Poster
2 posts since Jun 2008
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You