User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the VB.NET section within the Software Development category of DaniWeb, a massive community of 397,845 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,502 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our VB.NET advertiser:
Views: 2445 | Replies: 11
Reply
Join Date: Jul 2007
Posts: 24
Reputation: blondie.simon is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
blondie.simon blondie.simon is offline Offline
Newbie Poster

Combo Box

  #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
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Dec 2002
Location: West Virginia
Posts: 374
Reputation: waynespangler is on a distinguished road 
Rep Power: 6
Solved Threads: 37
waynespangler waynespangler is offline Offline
Posting Whiz

Re: Combo Box

  #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  
Join Date: Feb 2007
Location: Bangalore,India
Posts: 1,213
Reputation: debasisdas is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 78
debasisdas's Avatar
debasisdas debasisdas is offline Offline
Nearly a Posting Virtuoso

Re: Combo Box

  #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  
Join Date: Jul 2007
Posts: 24
Reputation: blondie.simon is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
blondie.simon blondie.simon is offline Offline
Newbie Poster

Re: Combo Box

  #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  
Join Date: Feb 2007
Location: Bangalore,India
Posts: 1,213
Reputation: debasisdas is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 78
debasisdas's Avatar
debasisdas debasisdas is offline Offline
Nearly a Posting Virtuoso

Re: Combo Box

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

Re: Combo Box

  #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  
Join Date: Dec 2002
Location: West Virginia
Posts: 374
Reputation: waynespangler is on a distinguished road 
Rep Power: 6
Solved Threads: 37
waynespangler waynespangler is offline Offline
Posting Whiz

Re: Combo Box

  #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  
Join Date: Jul 2007
Posts: 24
Reputation: blondie.simon is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
blondie.simon blondie.simon is offline Offline
Newbie Poster

Re: Combo Box

  #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  
Join Date: Nov 2006
Posts: 709
Reputation: QVeen72 is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 95
QVeen72's Avatar
QVeen72 QVeen72 is offline Offline
Master Poster

Re: Combo Box

  #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 8:22 am.
Reply With Quote  
Join Date: Jul 2007
Posts: 24
Reputation: blondie.simon is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
blondie.simon blondie.simon is offline Offline
Newbie Poster

Re: Combo Box

  #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  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb VB.NET Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the VB.NET Forum

All times are GMT -4. The time now is 7:51 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC