Windows Develop Bookmark and Share   
 index > Windows Forms General > How to add values to a combobox at design time so they actually exist and can be selected?
 

How to add values to a combobox at design time so they actually exist and can be selected?

I have a combobox and when working in the design view I click on the items property. I then add 5 items. At runtime after I select one of the 5 values the combobox has a .selectedvalue of Nothing.

What, pray tell, is the arcane secret of having the combobox actually work?
ihateliveid  Wednesday, March 04, 2009 5:18 PM
Hi

Try to use combobox.Text in place of combobox.selectedvalue.
If any problem let me know.


Thank you

Best Regards
Utkarsh Gajjar
Utkarsh Gajjar
  • Marked As Answer byihateliveid Wednesday, March 04, 2009 5:41 PM
  •  
Utkarsh  Wednesday, March 04, 2009 5:32 PM
Hi

Try to use combobox.Text in place of combobox.selectedvalue.
If any problem let me know.


Thank you

Best Regards
Utkarsh Gajjar
Utkarsh Gajjar
  • Marked As Answer byihateliveid Wednesday, March 04, 2009 5:41 PM
  •  
Utkarsh  Wednesday, March 04, 2009 5:32 PM
That worked quite well, thanks! It would have been nice if the Microsoft documentation on comboboxeshad mentioned that.
ihateliveid  Wednesday, March 04, 2009 5:43 PM

You can use google to search for other answers

Custom Search

More Threads

• Detect user press the "Enter" Button
• How to Anchor a Control in relation to another controls edge
• DebuggerStepThrough related question.
• Detecting if preview mode
• Bookmarking pages with the Web Brower control in C#
• Loading a Xml file to two different multiline textboxes
• Inheriting Windows Controls and lack of meaningful or even called overrides
• How can I add a margin to a GroupBoxPanel ?
• AutoScaleMode enumeration?
• Imaging for windows