Error

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
 
R

Radenko Zec

You have two times declared InitializeComponent.Expand Windows Form Designer
Generated Code
 
S

Stoitcho Goutsev \(100\)

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.
 
R

Radenko Zec

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top