【发布时间】:2011-07-16 13:43:01
【问题描述】:
我正在尝试调用 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 方法。要找到它,请注释掉您创建的那个,转到构造函数,将光标放在标识符 InitiailizeComponent 内,然后按 F12,这将带您到它。
-
您好,欢迎来到 Stack Overflow。如果您还没有,请浏览faq 和How to Ask 页面以查找有关如何在本网站上发布好问题的信息。尤其是,尽量向我们提供尽可能多的信息,以便为您提供帮助。
-
复制/粘贴您找到的 .NET 1.1 示例需要缓慢,一次一个声明和一个方法。把它全部粘贴进去,你就会得到一堆你无法解决的错误。在您的问题中未提及这一点并不能帮助我们帮助您。