hey guy, have onather problem.
I am trying to raise an exception if a user clicks the delete button but doesnt select a item in the listbox.
This is what i have:
try
{
if (dataListBox.SelectedIndex == null)
throw new Exception;
//deletes selected items
dataListBox.Items.RemoveAt(dataListBox.SelectedIndex);
isDirty = true;
}
catch (Exception err)
{
//spits out the errors if there are any
MessageBox.Show(err.Message, "Enter something into the txtbox", MessageBoxButtons.OK, MessageBoxIcon.Error);
}