Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple choice on WinForms

What's the best way of implementing a multiple choice option in Windows Forms? I want to enforce a single selection from a list, starting with a default value.

It seems like a ComboBox would be a good choice, but is there a way to specify a non-blank default value?
I could just set it in the code at some appropriate initialisation point, but I feel like I'm missing something.

like image 694
smh Avatar asked Aug 18 '08 13:08

smh


1 Answers

If you only want one answer from the group, then a RadioButton control would be your best fit or you could use the ComboBox if you will have a lot of options. To set a default value, just add the item to the ComboBox's collection and set the SelectedIndex or SelectedItem to that item.

Depending on how many options you are looking at, you can use a ListBox with the SelectionMode property set to MultiSimple, if it will be multiple choice or you could use the CheckBox control.

like image 168
Dale Ragan Avatar answered Oct 04 '22 21:10

Dale Ragan