开发者

dispose() and initializeComponent() method in C# make problems

I'm new to c# and have a problem with the methods i've told you in the title. the code is a little bit long so i posted it to pastebin. i'm using the 32feet.net api to list up bluetooth devices in a list.

the problems are in line 43 and 50 with the following statement:

Error 1 Type 'WindowsFormsApplication1.Form1' already defines a member called 'Dispose' with the same parameter types C:\Users\andre\documents\visual studio 2010\Projects\blueetoth\blueetoth\Form1.cs 43 33 blueetoth

and

*Error 2 Type 'WindowsFormsApplication1.Form1' already defines a member called 'InitializeComponent' with the same parameter types C:\Users\andre\documents\visual studio 2010\Projects\blueetoth\blueetoth\Form1.cs 50 22 blueetoth *

Pastebin: http://pastebin.com/LFEvaz2X

short version: dispose()

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

short version: 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);

    }
开发者_如何转开发


The forms designer employs partial classes - the InitializeComponent method is defined there. If you want to create your form in code yourself, don't use the designer but create a normal class and derive from Form yourself.

Dispose seems to be defined as well and isn't overrideable, so you don't need your method anyway.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜