Reputation:
When I change the combobox style to DropDownList, it works fine. But the thing is I can't display default text such as "Select a country" without making it as a option. "Select a country" should not be an option rather a default text which disappears when the user click on the combobox.
Upvotes: 0
Views: 1828
Reputation: 199
The best option would be to put "Select A Country" as an actual selection but assign it to a string and then within your code, have that as your default value so:
string s = "Select A Country"
if(combobox.Text != s)
{
combobox.Items.Remove(s);
}
this will remove the value once something else has been selected
Upvotes: 1