I don't know Vb.Net very well but here is c# where you create your own control giving the properties your default values.
public class MyNumericUpDown : NumericUpDown
{
public MyNumericUpDown():base()
{
DecimalPlaces = 2;
Minimum = decimal.MinValue;
Maximum = decimal.MaxValue;
Increment = 1;
}
}
As I said I don't know vb.Net but I think this is the translation...
Public Class MyNumericUpDown Inherits NumericUpDown
{
Public Sub New()
{
MyBase.New()
DecimalPlaces = 2
Minimum = decimal.MinValue
Maximum = decimal.MaxValue
Increment = 1
}
}
If you don't have a need to use NumericUpDown with constant defaults then creating a custom control wouldn't be of value and you should simply create different objects for each need.
numericUpDown1 = New NumericUpDown()
' Set the Minimum, Maximum, and other values as needed.
numericUpDown1.DecimalPlaces = 2
numericUpDown1.Maximum = decimal.MaxValue
numericUpDown1.Minimum = decimal.MinValue
numericUpDown1.Increment = 1
You would only use the Shadow
keyword to hide implementations in a base class for a class that you derived.