i am using listbox to get the input from user through textbox. if user gives input through textbox i can parse the value from listbox and do my operations.
now if user didnot give nay input, then listbox doesn’t contain anything.
i want that if listbox is empty it should show error in msg box..
i am trying my code but it is not working..
string text1 = lstboxbulkto.ToString();
if (lstboxbulkto.ToString().Equals(null))
{
MessageBox.Show("hiii");
}
where lstboxbulkto is the name of the listbox.
how can this be done.
To check if a Listbox is empty, you can use the Listbox.Items.Count property. If the value is
0, then the listbox is empty.