Click EVent Misunderstaninding
Posted on 2006-06-21
Hi, please can somebody explain to me how events works with C# Windows Programming. I mean take this for example. In the form I add a button, I then double click this button and it takes me into the code, where it generates an event.
private void button1_Click(object sender, EventArgs e)
Now, I thought ok, I will create one manually without double clicking it. So I add another button underneathe it called button2 and then I go into the code and manually type this
private void button2_Click(object sender, EventArgs e)
When I double click the button and it generates the code then it will fire the Click event. But in the case of button2, when I manually write the code it does not fire.
I am obviously missing the method of attaching the event to the button.
thanks in advance