Mario Cuervo

Mario Cuervo

  • NA
  • 26
  • 6.8k

Having to click twice the close button to close a form

Jul 25 2014 2:25 PM
I have the following code attached to SelectedIndexChange event of comoBox5:
 
private void comboBox5_SelectedIndexChanged(object sender, EventArgs e)
{
     _selectedValue = (int) comboBox5.SelectedValue;
     textBox1.Text = _selectedValue.ToString();
}
 
which works fine, except that it has a non desire side effect. When ever such code is active you will need to click twice the close button of the form (X) in order to close it.  Any ideas on how to avoid this side effect??
 

Answers (19)