Friday, September 27, 2013

Button not performing event correctly

Hi


I have created a button called "Restart"



Private void Restart_click (Object sender, EventArgs e)
{
Application.Restart();
}

later in the program i change the value of "restart" to "Finish" and use the following to change the button over



Restart.Text = "Finish";
Restart.click -= this,restart_click;
restart.click += this.Finish_click;

I then create a new event handler for the new finish button




Private void Finish_click (Object sender, EventArgs e)
{messageBox.Show("Button change over worked");
}



but for some reason the when the button displays finish and is clicked, the application restarts


What am i doing wrong


Thanks


Michael



No comments:

Post a Comment