0

我是 c# 新手,我在标题中告诉你的方法有问题。代码有点长,所以我将其发布到 pastebin。我正在使用 32feet.net api 在列表中列出蓝牙设备。

问题在第 43 行和第 50 行,声明如下:

错误 1 ​​类型“WindowsFormsApplication1.Form1”已经定义了一个名为“Dispose”的成员,其参数类型相同 C:\Users\andre\documents\visual studio 2010\Projects\blueetoth\blueetoth\Form1.cs 43 33 blueetoth

*错误 2 类型“WindowsFormsApplication1.Form1”已经定义了一个名为“InitializeComponent”的成员,其参数类型相同 C:\Users\andre\documents\visual studio 2010\Projects\blueetoth\blueetoth\Form1.cs 50 22 blueetoth *

粘贴箱:http : //pastebin.com/LFEvaz2X

简短版本:处置()

protected override void Dispose(bool disposing)
{
     base.Dispose(disposing);
}

简短版:initializeComponent

private void InitializeComponent()
    {
        this.mainMenu1 = new System.Windows.Forms.MainMenu();
        this.listBox1 = new System.Windows.Forms.ListBox();
        // 
        // listBox1
        // 
        this.listBox1.Location = new System.Drawing.Point(14, 14);
        this.listBox1.Size = new System.Drawing.Size(212, 212);
        // 
        // Form1
        // 
        this.ClientSize = new System.Drawing.Size(240, 268);
        this.Controls.Add(this.listBox1);
        this.Menu = this.mainMenu1;
        this.MinimizeBox = false;
        this.Text = "Form1";
        this.Load += new System.EventHandler(this.Form1_Load);

    }
4

1 回答 1

1

表单设计器使用部分类——InitializeComponent方法在那里定义。如果您想自己在代码中创建表单,请不要使用设计器,而是创建一个普通类并从您Form自己派生。

Dispose似乎也已定义并且不可覆盖,因此无论如何您都不需要您的方法。

于 2010-11-20T13:54:50.150 回答