[英]'object' does not contain a definition for 'Dispose'
protected override void Dispose(bool disposing)
在上面的行中,我遇到了錯誤。
錯誤是:
windowformapplication.form1.Dispose(bool): not suitable method found to override
1)您可能已經將class Form
class Form1
重命名為class Form1
而沒有重命名設計器文件,即Partial class Form.designer.cs
改為Partial class Form1.designer.cs
2)您的InitializeComponent(); 會在windowformapplication.form1()構造函數中刪除或添加注釋。
或嘗試在designer.cs中添加以下代碼。
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
確保您的Form1.cs從Form擴展。 例如公共局部類Form1:Form {..}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.