I have a combo box in which I have to display the dates from a database. The user has to select a date from the combo box to proceed further, but I don't know how to make the user aware of selecting the item from the combo box first in order to proceed further.
What process should be followed so that a user can get a message if he has not selected the date from the combo?
if (string.IsNullOrEmpty(ComboBox.SelectedText))
{
MessageBox.Show("Select a date");
}
Here is the perfect coding which checks whether the Combo Box Item is Selected or not:
if (string.IsNullOrEmpty(comboBox1.Text))
{
MessageBox.Show("No Item is Selected");
}
else
{
MessageBox.Show("Item Selected is:" + comboBox1.Text);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With