Windows Develop Bookmark and Share   
 index > Windows Forms Designer > VS 2008 Designer not executing default constructor anymore?
 

VS 2008 Designer not executing default constructor anymore?

Hi,

I just tested which type of code is executed by the WinForms Designer in VS 2008.
It seems that the designer is not executing the default constructor anymore.
I added a simple thing like this.Text = "foo"; nothing is changed in the designer.

Did I miss a change between VS 2005/2008?

tia

MCMoser  Friday, January 23, 2009 10:45 AM

Hi MCMoser,

> It seems that the designer is not executing the default constructor anymore.
Where is the default constructor?

I performed a test in VS08 but didn't reproduce the problem. In my test, I create a UserControl and add a TextBox on the UserControl. In the UserControl's default constructor, I set the Text property of the TextBox as follows:

public partial class UserControl1:UserControl
{
public UserControl1()
{
InitializeComponent();
this.textBox1.Text = "foo";
}
}

Build the project and add the UserControl onto a form. I see the text "foo" appears in the TextBox within the UserControl.

Since I couldn't reproduce the problem on my side, could you please tell me how to reproduce it?

Sincerely,
Linda Liu

Linda Liu  Thursday, January 29, 2009 8:05 AM

I did it the same way as you are describing it, but nothing I write in the constructor is executed.

I have SP1 installed, maybe is it part of it? Or is there a setting? ...

MCMoser  Thursday, January 29, 2009 11:53 AM

Hi MCMoser,

On my machine, I don't install either SP1 for VS08 or SP1 for .NET Framework 3.5.

If you're interested, you may have a try uninstalling SP1 for VS08 to see if the problem still exists.

Sincerely,
Linda Liu

Linda Liu  Friday, January 30, 2009 2:17 AM
I tested it on a PC without SP1, but I still get the same behavior...
Is there a setting? or is there a difference between Team Edition and Professional? The must be any difference somewhere, but I don't understand this...
MCMoser  Friday, January 30, 2009 10:06 AM

You can use google to search for other answers

Custom Search

More Threads

• ASP.NET Windows Forms
• How to Create Sub property in C#.Net 2005
• TextBox readOnly
• Text property in Windows Forms Designer
• Change TextBox drawing rectangle
• There is already a command handler for the menu command '5efc7975-14bc-11cf-9b2b-00aa00573819 : 15'.
• Hoe to Not Allow User to Delete Custom Controls at Desgin Time
• Designer form
• TextBox/ComboBox control height
• Regarding User Control