gpt4 book ai didi

c# - 'johny.Form 1' does not contain a definition for ' Form1_Load'

转载 作者:行者123 更新时间:2023-11-30 19:10:56 30 4
gpt4 key购买 nike

我有这个错误:

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?)

这是我从表单设计者那里得到的代码:

    // 
// 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 方法,而您正在尝试使用一个方法。

如果您在首次加载表单时不需要进行任何初始化,请删除该行,或者确保您有初始化(符合 EventHandler 委托(delegate)的签名)。

关于c# - 'johny.Form 1' does not contain a definition for ' Form1_Load',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14172404/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com