How do you stop the designer from auto generating code that sets the value for public properties on a user control?
views:
235answers:
3
A:
you don't need to stop it from doing it
just put your own initialization in Form_Load()
putting in values on the property windows will also override the default values that the designer generate with your own values.
paan
2008-08-27 08:09:39
A:
Add these attributes to the property in your control:
[Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
Will Dean
2008-08-27 08:12:38
+3
A:
Use the DesignerSerializationVisibilityAttribute on the properties that you want to hide from the designer serialization and set the parameter to Hidden.
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string Name
{
get;
set;
}
Erik Hellström
2008-08-27 08:13:13