Windows Develop Bookmark and Share   
 index > Windows Forms Designer > ComboBox list - display first item
 

ComboBox list - display first item

if i have a combo box and create a list using items:collection property, when the form is loaded the combobox field will be blank, i select the drop down arrow and i have my list and can select an item, fair enough.

is it standard practice not to initially display the first item from the list in the combobox field when the form is first loaded?

is there a way of changing this so that it can display the first item?

thanks,

anotherchance  Tuesday, December 18, 2007 10:14 AM

Hiļ¼?if you want to set the first item in default combobox ,you can try this

Me.ComboBox1.SelectedIndex = 0

If you have any further questions, feel free to let me know.

Best Regards

Gavin

Gavin Jin - MSFT  Wednesday, December 19, 2007 5:09 AM
i don't think this can be done dynamically.

however, you can use a more amateuristic method
while loading the form you can modifity the default value of the combobox using combobox1.text = ....

so you can fetch one of the items from the collection,and put it as combobox.text
then just fill up the rest starting from the second value

no ? Smile
xor.be  Tuesday, December 18, 2007 2:48 PM

Hiļ¼?if you want to set the first item in default combobox ,you can try this

Me.ComboBox1.SelectedIndex = 0

If you have any further questions, feel free to let me know.

Best Regards

Gavin

Gavin Jin - MSFT  Wednesday, December 19, 2007 5:09 AM

that's great stuff, nice and simple, thanks very much gavin

anotherchance  Thursday, December 20, 2007 4:52 PM
Hi

Do you know how to select an item in a combobox programatically and reflect the changes in the Text property.

This must be done so that when the application starts the required list item in the combobox is shown.

Daniel
DMC_Daniel  Thursday, March 26, 2009 10:36 PM

You can use google to search for other answers

Custom Search

More Threads

• How to get Domain Role collection
• Copy Form Design to another Form or Application?
• How can I implement the property DataBindings in a Smart Tag of a control
• I 'm having a problem with my User Control
• DesignSurface MemoryLeak
• Printing controls
• Form designer error - please HELP ME
• Infragistics for windows forms
• TreeView scrolling
• Font Change