开发者

how to change and write static void

I have problem in writing the code in windows form application my problem is I need to write

private static void DownloadFiles(IEnumerable<st开发者_JAVA技巧ring> filenames, 
    string uri, string localPath, string user, string password)

However, when I write it, I get the following error:

'WindowsFormsApplication10.Form1' does not contain a definition for 'Form1_Load' and no extension method 'Form1_Load' accepting a first argument of type 'WindowsFormsApplication10.Form1' could be found (are you missing a using directive or an assembly reference?) C:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\WindowsFormsApplication10\WindowsFormsApplication10\Form1.Designer.cs  

Please help me Thanks in advance


This is normally because you have managed to get the IDE to generate a form load event handler (by double clicking on the form), and have deleted the method without deleting the designer generated code to link the method with the event.

If you go to Form1.Designer.cs you should see a line that looks like this:

this.Load += new System.EventHandler(this.Form1_Load);

Delete this line.


go through the designer.cs of form1 check there must be given the defination of form1.load delete that and again create the load event of form1 . Moreover the problem is with ur designer only. check this it will work


My guess is that you double clicked in Form1's designer to get to the code and it automatically generated a Form1_Load method to respond to form1's Load event. Some time after that, you may have deleted this code. Form1's designer still has a reference to that event handler.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜