'johny.Form1'不包含'Form1_Load'的定义 [英] 'johny.Form1' does not contain a definition for 'Form1_Load'

查看:396
本文介绍了'johny.Form1'不包含'Form1_Load'的定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有此错误:


错误1'johny.Form1'不包含'Form1_Load'
的定义并且找不到扩展方法'Form1_Load'接受
类型'johny.Form1'的第一个参数(您是否缺少使用指令
或程序集引用?)

Error 1 'johny.Form1' does not contain a definition for 'Form1_Load' and no extension method 'Form1_Load' accepting a first argument of type 'johny.Form1' could be found (are you missing a using directive or an assembly reference?)

这是表单设计者的代码:

This is my code from the form's designer:

    // 
    // Form1
    // 
    this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
    this.ClientSize = new System.Drawing.Size(456, 411);
    this.Controls.Add(this.l6);
    this.Controls.Add(this.label1);
    this.Name = "Form1";
    this.Text = "Form1";
    this.Load += new System.EventHandler(this.Form1_Load);
    this.ResumeLayout(false);
    this.PerformLayout();

错误来自以下行:

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


推荐答案

错误告诉您您没有 Form1 类中的 Form1_Load 方法,而您正在尝试使用其中的一个。

The error is telling you that you don't have a Form1_Load method in your Form1 class, and you are trying to use one.

如果在第一次加载表单时不需要进行任何初始化,或者确保您确实有一个(符合 EventHandler的签名代表)。

Delete that line if you don't need to do any initialization when the form first loads, or ensure you do have one (that conforms to the signature of the EventHandler delegate).

这篇关于'johny.Form1'不包含'Form1_Load'的定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆