I have done a simple windows form. My button is firing only on the second click. Why is that ?
private void button1_Click(object sender, EventArgs e)
{
//button1.Enabled = false; will disable the button before the event is fired
this.button1.Click += new System.EventHandler(this.dosomething);
}
private void dosomething(object sender, System.EventArgs e)
{
listBox1.Items.Add("Initializing :" + cart + "...");
this.button1.Click -= new System.EventHandler(this.dosomething);
}
Can some one explain this.