dimanche 15 mars 2015

Setting default selected index of a combobox

I have a questionnaire linked to a database and a combobox asking if the user has been diagnosed. I want to make it so that when the form loads the selected index is set to 0, (yes) and therefore the text shown in the combo box is set to yes, allowing the user to change to no, if necessary.


I assumed it would be simple and therefore just:



InitializeComponent();

diagnosedComboBox.SelectedIndex = 0;


However this doesn't work, I'm sure it's pretty straight forward however I couldn't find anything on here to solve it.


Aucun commentaire:

Enregistrer un commentaire