DefaultValueAttribute with decimal Type Property

G

Guest

Can you use the DefaultValueAttribute on Decimal PropertyFields? If so what
is format for setting the Default value.

Thanks...


Example
/// <summary>
/// Field: increment value
/// </summary>
private decimal increment;
/// <summary>
/// Property: Gets or Sets the increment value
/// </summary>
[Bindable(true)
,Browsable(true)
//,DefaultValue(1.0m)
,Category("Incrementing")]
public decimal Increment
{
[DebuggerStepThrough()]
get
{
return increment;
}
[DebuggerStepThrough()]
set
{
increment = value;
}
}
 
G

Guest

Thanks I actually have done that but this dosn't stop the designer from
generating code for Decimal properties with Default values..

There must be a way of doing that as Microsofts NumericUpDown seems to
somehow have default values assigned to the Decimal Properties but I
I checked the attributes on the NumericUpDown.Maximum and they are as
listed below..

There must be a way of doing this???


Attributes on The NumericUpDown Type
---------------------------------------------
System.ComponentModel.DefaultEventAttribute
System.ComponentModel.DefaultPropertyAttribute
System.ComponentModel.DesignerAttribute
System.ComponentModel.DesignerAttribute
System.ComponentModel.DesignerAttribute
System.ComponentModel.ToolboxItemFilterAttribute
System.ComponentModel.Design.Serialization.DesignerSerializerAttribute
System.ComponentModel.DesignerCategoryAttribute


Attributes on The NumericUpDown.Maximum Property
-------------------------------------------------------------
System.Windows.Forms.SRDescriptionAttribute
System.ComponentModel.RefreshPropertiesAttribute
System.Windows.Forms.SRCategoryAttribute

Sijin Joseph said:
use 1.0d

Sijin Joseph
http://www.indiangeek.net
http://weblogs.asp.net/sjoseph


Can you use the DefaultValueAttribute on Decimal PropertyFields? If so what
is format for setting the Default value.

Thanks...


Example
/// <summary>
/// Field: increment value
/// </summary>
private decimal increment;
/// <summary>
/// Property: Gets or Sets the increment value
/// </summary>
[Bindable(true)
,Browsable(true)
//,DefaultValue(1.0m)
,Category("Incrementing")]
public decimal Increment
{
[DebuggerStepThrough()]
get
{
return increment;
}
[DebuggerStepThrough()]
set
{
increment = value;
}
}
 

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