I got a ComboBox with a couple of items. I want to put SelectedIndex
of the ComboBox to 0
, so when the user starts it, the first item is already selected (as default).
However, doing this (combobox.SelectedIndex = 0;
) interferes with my event combobox_SelectedIndexChanged()
, which occurs when the user changes the SelectedIndex of the ComboBox, restarting the program:
private void combobox_SelectedIndexChanged(object sender, EventArgs e)
{
Process.Start(Application.ExecutablePath);
this.Close();
}
This will cause combobox_SelectedIndexChanged()
to loop endlessy, ascombobox.SelectedIndex = 0;
will trigger it, which again will trigger the other one and so forth...
Is there any way to let the program do something upon changing of the SelectedIndex by the user without this looping?