<p>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.</p>

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

[{'answer_id': 14624, 'author': 'rjzii', 'author_id': 1185, 'author_profile': 'https://Stackoverflow.com/users/1185', 'pm_score': 2, 'selected': False, 'text': '<p>You should be able to just set the ComboBox.SelectedIndex property with what you want the default value to be.</p>\n\n<p><a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.combobox.selectedindex.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/system.windows.forms.combobox.selectedindex.aspx</a></p>\n'}, {'answer_id': 14626, 'author': 'Yaakov Ellis', 'author_id': 51, 'author_profile': 'https://Stackoverflow.com/users/51', 'pm_score': 2, 'selected': False, 'text': '<p>Use the <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.combobox.selecteditem.aspx" rel="nofollow noreferrer">ComboBox.SelectedItem</a> or <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.combobox.selecteditem.aspx" rel="nofollow noreferrer">SelectedIndex</a> property after the items have been inserted to select the default item.</p>\n\n<p>You could also consider using <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.combobox.selecteditem.aspx" rel="nofollow noreferrer">RadioButton</a> control to enforce selection of a single option.</p>\n'}, {'answer_id': 14640, 'author': 'Dale Ragan', 'author_id': 1117, 'author_profile': 'https://Stackoverflow.com/users/1117', 'pm_score': 4, 'selected': True, 'text': "<p>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.</p>\n\n<p>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.</p>\n"}, {'answer_id': 14643, 'author': 'Wilka', 'author_id': 1367, 'author_profile': 'https://Stackoverflow.com/users/1367', 'pm_score': 2, 'selected': False, 'text': '<p>You can use a ComboBox with the <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.combobox.dropdownstyle.aspx" rel="nofollow noreferrer">DropDownStyle</a> property set to DropDownList and SelectedIndex to 0 (or whatever the default item is). This will force always having an item from the list selected. If you forget to do that, the user could just type something else into the edit box part - which would be bad :)</p>\n'}, {'answer_id': 14710, 'author': 'wusher', 'author_id': 1632, 'author_profile': 'https://Stackoverflow.com/users/1632', 'pm_score': 1, 'selected': False, 'text': "<p>If you are giving the user a small list of choices then stick with the radio buttons. However, if you will want want to use the combo box for dynamic or long lists. Set the style to DropDownList.</p>\n\n<pre><code>private sub populateList( items as List(of UserChoices))\n   dim choices as UserChoices\n   dim defaultChoice as UserChoices \n\n   for each choice in items\n      cboList.items.add(choice)\n      '-- you could do user specific check or base it on some other \n      '---- setting to find the default choice here\n      if choice.state = _user.State or choice.state = _settings.defaultState then \n          defaultChoice = choice\n      end if \n   next \n   '-- you chould select the first one\n   if cboList.items.count &gt; 0 then\n      cboList.SelectedItem = cboList.item(0)\n   end if \n\n   '-- continuation of hte default choice\n   cboList.SelectedItem = defaultChoice\n\nend sub\n</code></pre>\n"}]
['https://Stackoverflow.com/questions/14618', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1077/']