Combo Box

Please support our VB.NET advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Jul 2007
Posts: 24
Reputation: blondie.simon is an unknown quantity at this point 
Solved Threads: 0
blondie.simon blondie.simon is offline Offline
Newbie Poster

Combo Box

 
0
  #1
Jul 25th, 2007
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
Reply With Quote Quick reply to this message  
Join Date: Dec 2002
Posts: 461
Reputation: waynespangler is on a distinguished road 
Solved Threads: 56
waynespangler waynespangler is offline Offline
Posting Pro in Training

Re: Combo Box

 
0
  #2
Jul 25th, 2007
you could use a listbox instead.
Wayne

It is hard to understand how a cemetery can raise its burial rates and blame it on the cost of living.
Reply With Quote Quick reply to this message  
Join Date: Feb 2007
Posts: 2,149
Reputation: debasisdas will become famous soon enough debasisdas will become famous soon enough 
Solved Threads: 132
debasisdas's Avatar
debasisdas debasisdas is offline Offline
Postaholic

Re: Combo Box

 
0
  #3
Jul 26th, 2007
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.
Share your Knowledge.
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 24
Reputation: blondie.simon is an unknown quantity at this point 
Solved Threads: 0
blondie.simon blondie.simon is offline Offline
Newbie Poster

Re: Combo Box

 
0
  #4
Jul 26th, 2007
Originally Posted by waynespangler View Post
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.
Reply With Quote Quick reply to this message  
Join Date: Feb 2007
Posts: 2,149
Reputation: debasisdas will become famous soon enough debasisdas will become famous soon enough 
Solved Threads: 132
debasisdas's Avatar
debasisdas debasisdas is offline Offline
Postaholic

Re: Combo Box

 
0
  #5
Jul 26th, 2007
what bout setting the listindex to zero.
Last edited by debasisdas; Jul 26th, 2007 at 4:01 am.
Share your Knowledge.
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 24
Reputation: blondie.simon is an unknown quantity at this point 
Solved Threads: 0
blondie.simon blondie.simon is offline Offline
Newbie Poster

Re: Combo Box

 
0
  #6
Jul 26th, 2007
Originally Posted by debasisdas View Post
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.
Reply With Quote Quick reply to this message  
Join Date: Dec 2002
Posts: 461
Reputation: waynespangler is on a distinguished road 
Solved Threads: 56
waynespangler waynespangler is offline Offline
Posting Pro in Training

Re: Combo Box

 
1
  #7
Jul 26th, 2007
Set item 0 to "Please select an item" and the listindex to 0.
Wayne

It is hard to understand how a cemetery can raise its burial rates and blame it on the cost of living.
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 24
Reputation: blondie.simon is an unknown quantity at this point 
Solved Threads: 0
blondie.simon blondie.simon is offline Offline
Newbie Poster

Re: Combo Box

 
0
  #8
Jul 26th, 2007
Originally Posted by waynespangler View Post
Set item 0 to "Please select an item" and the listindex to 0.

Great Idea :-) Thanks

Simon
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 848
Reputation: QVeen72 is on a distinguished road 
Solved Threads: 120
QVeen72's Avatar
QVeen72 QVeen72 is offline Offline
Practically a Posting Shark

Re: Combo Box

 
0
  #9
Jul 29th, 2007
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
Last edited by QVeen72; Jul 29th, 2007 at 9:22 am.
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 24
Reputation: blondie.simon is an unknown quantity at this point 
Solved Threads: 0
blondie.simon blondie.simon is offline Offline
Newbie Poster

Re: Combo Box

 
0
  #10
Jul 29th, 2007
Originally Posted by QVeen72 View Post
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
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 5409 | Replies: 11
Thread Tools Search this Thread



Tag cloud for VB.NET
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC