C# 已定义名为';初始化组件';使用相同的参数类型

C# 已定义名为';初始化组件';使用相同的参数类型,c#,.net,windows,C#,.net,Windows,我试图调用InitializeComponent方法,但出现以下错误: Type 'WindowsFormsApplication1.Form1' already defines a member called 'InitializeComponent' with the same parameter types 代码如下: public Form1() { InitializeComponent(); } private voi

我试图调用InitializeComponent方法,但出现以下错误:

Type 'WindowsFormsApplication1.Form1' already defines a member called 'InitializeComponent' with the same parameter types
代码如下:

 public Form1()
        {
            InitializeComponent();
        }

 private void InitializeComponent()
    {
      this.Browser = new WebBrowser();
      this.panel1 = new Panel();
      this.txtNavigate = new TextBox();
      this.cmdGo = new Button();
    }
  }

已经定义了名为InitializeComponent的方法,请检查设计器生成的代码。

使用部分更改私有关键字:

partial void InitializeComponent()

这样,您就可以拥有任意多个同名的成员。

很明显,您的类已经有了InitializeComponent方法。要找到它,请注释掉您所做的,转到构造函数,将光标放在标识符InitiailizeComponent内并点击F12,这将带您找到它。您好,欢迎来到Stack Overflow。如果您还没有,请浏览和页面,查找有关如何在此网站上发布好问题的信息。特别是,请尝试提供我们所需的尽可能多的信息以帮助您。复制/粘贴您找到的.NET 1.1示例需要缓慢,一次一个声明和一个方法。粘贴所有内容,你只会得到堆积如山的错误,你无法解决。在你的问题中不提及这一点无助于我们帮助你。