我试图调用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();
}
}
答案 0 :(得分:2)
已经定义了一个名为InitializeComponent的方法,检查设计器生成的代码。
答案 1 :(得分:0)
使用部分:
更改私有关键字partial void InitializeComponent()
通过这种方式,您可以拥有任意数量的具有相同名称的成员。