dear friends
I want to add and remove items with this simple code :
this exception appears after add and remove some data and Leave the control on Application.Run (new Form1()); method;
InvalidArgument =Value of '0' is not valid for 'index'.
thank you.
I want to add and remove items with this simple code :
Code:
private void comboBox1_KeyDown(object sender, KeyEventArgs e)
{
ComboBox c = sender as ComboBox;
if (c == null) return;
if (c.Text == "") return;
if (e.KeyCode == Keys.Delete)
{
c.Items.RemoveAt(c.FindStringExact(c.Text));
}
else if (e.KeyCode == Keys.Enter)
c.Items.Add(c.Text);
}
this exception appears after add and remove some data and Leave the control on Application.Run (new Form1()); method;
InvalidArgument =Value of '0' is not valid for 'index'.
thank you.
Comment