Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / VB.NET / July 2007

Tip: Looking for answers? Try searching our database.

setting a default value for a combo box...

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Brad Pears - 27 Jul 2007 21:10 GMT
In my vb.net 2005 project I have a few combo boxes where I want to set a
default value. I am not binding these combo boxes - I am loading the values
directly in code from a dataset.

Obviously the default I am settign will be one of the values from teh drop
down list..

How do you set a default value for a combo box??

Thanks,  Brad
Brad Pears - 27 Jul 2007 21:52 GMT
PS...  If I try to set the text property, whatever I type in there is
erased... This is what I thought I would have to do  to set a default...

Brad
> In my vb.net 2005 project I have a few combo boxes where I want to set a
> default value. I am not binding these combo boxes - I am loading the
[quoted text clipped - 6 lines]
>
> Thanks,  Brad
Kerry Moorman - 27 Jul 2007 22:26 GMT
Brad,

If the combo box contains strings, you can set the SelectedItem property to
one of the strings to select it.

Or you can set the SelectedIndex property to the zero-based index of the
item to be selected.

Keep in mind that selecting a default value will have the side effect of
causing the SelectedIndexChanged event to fire.

Kerry Moorman

> PS...  If I try to set the text property, whatever I type in there is
> erased... This is what I thought I would have to do  to set a default...
[quoted text clipped - 10 lines]
> >
> > Thanks,  Brad

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.