Reputation: 219
I want to display member of combo box(add) in windows form before clicking drop list, the members which I'm trying to display are "Add, delete, clear, modify". But despite of setting display member property equal to "add" from property window statically, I'm unable to see "add" in combo box at run time before clicking drop down list of combo box.
Could anyone please tell me what's wrong I'm doing?
Upvotes: 0
Views: 1565
Reputation: 1355
In your case, given the fact that you already know what values the dropdownlist will have, you can just say myComboBox.Text = "Add"
Have fun coding!
Upvotes: 0
Reputation: 2165
I guess that
ComboBoxName.SelectedItem = "Add";
should work. You can put this in the Form Load method.
Upvotes: 2
Reputation: 48547
Change your SelectedIndex
to 0
in your code and this will select the first item in the list.
myComboBox.SelectedIndex = 0;
Upvotes: 2