Windows Develop Bookmark and Share   
 index > Windows Forms Designer > 'InitializeComponent' is generated by the designer :)
 

'InitializeComponent' is generated by the designer :)

hello
I have a class in witch I've implemented my private InitializeComponent function(like the WinForms Designer does).



Code Block

public abstract class MyClass : MainClass

{

private void InitializeComponent()

{

this.FlatStyle = FlatStyle.Flat;

this.SuspendLayout();

this.ResumeLayout(false);

}

protected MyClass()

: base()

{

InitializeComponent();

}

}

}


Now, the CodeAnalysis warn me:

Warning 1 The designer cannot process the code at line 35:

this.FlatStyle = FlatStyle.Flat;

The code within the method 'InitializeComponent' is generated by the designer and should not be manually modified. Please remove any changes and try opening the designer again.
Smile


I thik, this is a bug in VS (I use 2008)...
Sergiu Dudnic  Saturday, December 29, 2007 8:59 AM

This isn't actually a Code Analysis warning - this is produced by the Windows Forms Designer, and such have moved it to the appropriate forum.

  • Proposed As Answer byonlinetechi Thursday, May 07, 2009 9:29 AM
  • Unproposed As Answer bySergiu Dudnic Tuesday, May 12, 2009 9:05 AM
  •  
David M. Kean  Monday, December 31, 2007 5:06 PM
Move manually implemented code outside initialise component function
hello
I have a class in witch I've implemented my private InitializeComponent function(like the WinForms Designer does).



Code Block

public abstract class MyClass : MainClass

{

private void InitializeComponent()

{

this.FlatStyle = FlatStyle.Flat;

this.SuspendLayout();

this.ResumeLayout(false);

}

protected MyClass()

: base()

{

InitializeComponent();

}

}

}


Now, the CodeAnalysis warn me:

Warning 1 The designer cannot process the code at line 35:

this.FlatStyle = FlatStyle.Flat;

The code within the method 'InitializeComponent' is generated by the designer and should not be manually modified. Please remove any changes and try opening the designer again.
Smile


I thik, this is a bug in VS (I use 2008)...

onlinetechi  Thursday, May 07, 2009 9:31 AM
Move manually implemented code outside initialise component function
I have a CUSTOM control in witch I have created MYSELF a function named InitializeComponent(). I have no other code that manually implemented. :)

Best regards, Sergiu
Sergiu Dudnic  Tuesday, May 12, 2009 9:09 AM

You can use google to search for other answers

Custom Search

More Threads

• User Controls Direct Click Access
• Convert BasicDesignerLoader to CodeDomDesignerLoader
• Changing font of ErrorProvider and DataGridViewRow.ErrorText
• View Designer Error message!
• Working with Created Property of Text Box
• How to stop a textbox from autosizing in windows forms
• Inherited forms and the designer (again)
• How customize data in datagridview with bound columns?
• Desinger Not drawing some components
• Form Designer problem with Inheritance Events?