Forms designer load error.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I added my own property (a double) to a derived component which can be edited
in the property browser and is serializable. When I enter a small number such
as .00001, the code generated in InitializeComponent() looks like this:

this.StartTime.Increment = 1E-05;

This compiles and runs fine, but the forms designer barfs and won't open the
form. If I change the initialization to this:

this.StartTime.Increment = 1.0E-05;

then the form is happy. The form designer doesn't seem to understand and
exponent without a decimal point.

Any ideas? Here's what I'm using to get/set the value.


protected double increment = 1.0E-6;;
....


[Category("Misc"),
Description("Gets or sets the numeric control increment value."),
DefaultValueAttribute(1.0E-6),

DesignerSerializationVisibility(DesignerSerializationVisibility.Visible),
TypeConverterAttribute(typeof(DoubleConverter))]
override public object Increment
{
get { return increment; }
set { increment = Convert.ToDouble(value); }
}
 
If you change the property type to double everything may work fine.

Regards,
Frank Hileman

check out VG.net: www.vgdotnet.com
Animated vector graphics system
Integrated Visual Studio .NET graphics editor
 
And remove the DesignerSerializationVisibility
and TypeConverter attributes. You don't need them.

/claes

Frank Hileman said:
If you change the property type to double everything may work fine.

Regards,
Frank Hileman

check out VG.net: www.vgdotnet.com
Animated vector graphics system
Integrated Visual Studio .NET graphics editor

GP said:
I added my own property (a double) to a derived component which can be
edited
in the property browser and is serializable. When I enter a small number
such
as .00001, the code generated in InitializeComponent() looks like this:

this.StartTime.Increment = 1E-05;

This compiles and runs fine, but the forms designer barfs and won't open
the
form. If I change the initialization to this:

this.StartTime.Increment = 1.0E-05;

then the form is happy. The form designer doesn't seem to understand and
exponent without a decimal point.

Any ideas? Here's what I'm using to get/set the value.


protected double increment = 1.0E-6;;
...


[Category("Misc"),
Description("Gets or sets the numeric control increment value."),
DefaultValueAttribute(1.0E-6),

DesignerSerializationVisibility(DesignerSerializationVisibility.Visible),
TypeConverterAttribute(typeof(DoubleConverter))]
override public object Increment
{
get { return increment; }
set { increment = Convert.ToDouble(value); }
}
 
Thanks, this looked good until I realized that this parameter is inherited
from a base class where it wouldn't be appropriate to change the type to
double.

Frank Hileman said:
If you change the property type to double everything may work fine.

Regards,
Frank Hileman

check out VG.net: www.vgdotnet.com
Animated vector graphics system
Integrated Visual Studio .NET graphics editor

GP said:
I added my own property (a double) to a derived component which can be
edited
in the property browser and is serializable. When I enter a small number
such
as .00001, the code generated in InitializeComponent() looks like this:

this.StartTime.Increment = 1E-05;

This compiles and runs fine, but the forms designer barfs and won't open
the
form. If I change the initialization to this:

this.StartTime.Increment = 1.0E-05;

then the form is happy. The form designer doesn't seem to understand and
exponent without a decimal point.

Any ideas? Here's what I'm using to get/set the value.


protected double increment = 1.0E-6;;
...


[Category("Misc"),
Description("Gets or sets the numeric control increment value."),
DefaultValueAttribute(1.0E-6),

DesignerSerializationVisibility(DesignerSerializationVisibility.Visible),
TypeConverterAttribute(typeof(DoubleConverter))]
override public object Increment
{
get { return increment; }
set { increment = Convert.ToDouble(value); }
}
 
Back
Top