Reputation: 5848
In my ComboBox, the field is blank before users click it and choose any item. So without users click on the ComboBox, it remains empty. How do we check whether the ComboBox is empty or not?
This codes gives me an error because there is no item selected yet:
if( ComboBox.SelectedItem.ToString().Equals("") )
{
//do something
}
Upvotes: 16
Views: 66567
Reputation: 116
ComboBox.SelectedItems.Count
this should work :P it counts selected items. if that number is 0, no items are selected.
Upvotes: 3