Re: Visual C# simple problem
Quote:
Originally Posted by
MightUndoIt
Hi,
Error 1 'WindowsFormsApplication1.Form1' does not contain a definition for 'button1_Click' and no extension method 'button1_Click' accepting a first argument of type 'WindowsFormsApplication1.Form1' could be found (are you missing a using directive or an assembly reference?) C:\Users\Username\AppData\Local\Temporary Projects\WindowsFormsApplication1\Form1.Designer.cs 42 64 WindowsFormsApplication1
This error is quite clear you unfortunatly created a click event by doing some clicks in the enviroment and when you delete the click events delegate you also need to delete the line where this delegate is used.
Goto the Form1.Designer.cs
How to do: rightclicking in Form1.cs the Forms
InitializeComponent() method s and use 'goto definition' in the context menue then this will open the method which is located in the Dorm1.Designer.cs
and in that method find the line
Code:
button1.Click += new System.EventHandler(this.button1_Click);
and remove that line
Then the error is gone :D
Re: Visual C# simple problem
Simple way, you double click on error line in Error list window, VS will help you find where a line make this error. In this situation, you can delete error line.
Re: Visual C# simple problem
Quote:
Originally Posted by
zquanghoangz
Simple way, you double click on error line in Error list window, VS will help you find where a line make this error. In this situation, you can delete error line.
Sorry if you only delete the errormessage and recompile you will still get the same erormessage you really need to go to the click event in the design view and there deleting the event delegate so this field of the click event is empty
Re: Visual C# simple problem
What I mean it really like you talk. Maybe I write too hard to understand.
When you delete function, I will have error message, because delegate event already exist.
So, double click on error you will go to error line. Delete that line. It's OK.
I think it is normal error. Many newbie meet.