I am trying to show a Messagebox to come up if the combobox contains only one item and then terminate the program execution when the user dismisses the message box. This is done in Winform.
Code:
private void btn_add_Click(object sender, EventArgs e)
{
if (combobox.SelectedIndex != -1)
ListBox.Items.Add(combobox.SelectedItem);
combobox.Items.RemoveAt(combobox.SelectedIndex);
else if(combobox.SelectionLength = null)
MessageBox.Show("ComboBox must have one item left", " Warning", MessageBoxButtons.OKCancel);
}
Comment