Windows Develop Bookmark and Share   
 index > Windows Forms General > ComboBox.SelectedIndex problem
 

ComboBox.SelectedIndex problem

Hi in asp.net I can easily do the following on a databound dropdown list:

myDdl.SelectedIndex = myDdl.Items.IndexOf(myDdl.Items.FindByValue("MyItem"));

So that it would show say the 3rd (or whatever) item in the list on load

How do I do the same for a comboBox in win forms?

Thanks

ricc  Wednesday, February 14, 2007 10:49 PM
You can either use SelectedIndex, SelectedItem, SelectedText, or SelectedValue depending on what you have and what you're trying to do. I'm probabbly misunderstanding your question. As far as I can tell the comboboxes are pretty much the same between asp.net and windows forms.net
Larry Charlton  Wednesday, February 14, 2007 11:14 PM
You can either use SelectedIndex, SelectedItem, SelectedText, or SelectedValue depending on what you have and what you're trying to do. I'm probabbly misunderstanding your question. As far as I can tell the comboboxes are pretty much the same between asp.net and windows forms.net
Larry Charlton  Wednesday, February 14, 2007 11:14 PM

You can use google to search for other answers

Custom Search

More Threads

• ToolTip control invokes parent OnMouseMove
• *some* Gifs crash in PictureBox with general GDI+ error
• MenuItem underscore under &letter problem
• MDI parent background?
• AutoCompleteMode Append Bug (doesn't handle slash '/')
• Shortcut for ToolStripMenuItem
• Cursor "themes" in .NET?
• Tree View+Table
• How can I manipulate .ICL files (Icon Library Files) in VB.NET?
• Using an ActiveX COM component in C# class library