Error

  • Thread starter Thread starter Miks
  • Start date Start date
M

Miks

Hi Friends,

I'm new to Windows forms learning it.

In VS2005 Windows Apps the code is

public Form1()
{
InitializeComponent();
Test();
}


I just pasted code to write InitializeComponent() as

private void InitializeComponent()
{
this.btnProcess = new System.Windows.Forms.Button();
this.btnClose = new System.Windows.Forms.Button();
}

I'm getting error

Error 1 Type 'WindowsApplication1.Form1' already defines a member
called 'InitializeComponent' with the same parameter types C:\Documents
and Settings\sivarama\My Documents\Visual Studio
2005\Projects\WindowsApplication1\WindowsApplication1\Form1.cs 16 21 WindowsApplication1


Pls help
 
You have two times declared InitializeComponent.Expand Windows Form Designer
Generated Code
 
Radenko,

VS 2005 uses partial classes. The original InitializeComponent is in
*.Designer.cs file. If you don't see it in the solution explorer click on
the "Show All Files" button form the solution explorer's tool bar.

BTW you are not supposed to write in there. If you need custom intiazliation
create new methods and all it from the constructor after or before
IntializeComponent call.
 
Sorry I dont seen that is vs2005 sorry :-)



Stoitcho Goutsev (100) said:
Radenko,

VS 2005 uses partial classes. The original InitializeComponent is in
*.Designer.cs file. If you don't see it in the solution explorer click on
the "Show All Files" button form the solution explorer's tool bar.

BTW you are not supposed to write in there. If you need custom
intiazliation create new methods and all it from the constructor after or
before IntializeComponent call.
 
Back
Top