Reputation: 57
I am just testing with the buttons and textboxes when I found that 2 buttons and a textbox isn't doing anything while the 2 buttons are working just fine.
0 references
is showing over these buttons
private void button1_Click(object sender, EventArgs e)
{
}
The buttons does exist in Form (Design). those which are working shows 1 references
Upvotes: 0
Views: 991
Reputation: 74700
Just because the method button1_Click
(please name your buttons something better; it takes just a couple of seconds to rename a button after you add it to a form) exists in Form1.cs does not mean it's wired up to be the button click handler
button1_Click
Oh, and take the time to rename all your buttons, so they are called like saveButton
, cancelButton
- it'll make your program a lot easier to read both for yourself and others you ask for help from eg on SO. Then rename your click handlers by focusing the caret on the method name and pressing Ctrl-R-R. Files like Form1 can be renamed and if the class inside them is also called Form1 then VS will offer to rename the class too, bonus! :)
Upvotes: 2