我是C#的新手,并且对您在标题中告诉您的方法有问题。该代码长一点时间,因此我将其发布给Pastebin。我正在使用32feet.net API列出列表中的蓝牙设备。

问题在第43行和50行,并具有以下声明:

错误1类型'WindowsFormsApplication1.form1'已经定义了一个名为“ Dispose”的成员,具有相同的参数类型C: Users Andre documents visual Studio Visual Studio 2010 Projects blueetoth blueetoth blueetoth form1.cs 43 33 Blueetoth Blueetoth

*错误2键入'WindowsFormsApplication1.form1'已经定义了一个名为“ prinitizecomponent”的成员,具有相同的参数类型c: users andre documents visual Studio Visual Studio 2010 projects blueetoth blueetoth blueetoth blueetoth form1.cs 50 22 blueetoth * blueetoth * blueetoth * blueetoth *

Pastebin: http://pastebin.com/lfevaz2x

简短版本:dispose()

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

    }
有帮助吗?

解决方案

表格设计师采用部分类别 - InitializeComponent 方法在那里定义。如果您想自己在代码中创建表单,请不要使用设计师,而要创建一个普通类,而是从 Form 你自己。

Dispose 似乎也被定义并且不可过分填充,因此您无论如何都不需要方法。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top