Inheritance from TextBox

Jarod

Regular
Joined
Feb 5, 2003
Messages
82
Location
Bruxelles
I have created a special textBox which will allow only numeric values. (called NumericTextBox)
It's working well, but when I am puuting such a TextBox on my form at design time, the default Text value is "NumericTextBox1"

How can I get rid of that default property value and set my own?
Do I have to shadow the TextBox.Text property ?

Thanks,
 
That's what I think, however I don't succeed doing that.
Indeed, by implementing my own property, I am loosing the normal working of the textbox (managing the TextBox.Text and my new text member).

So the ideal would be :

instead of having something like:
Visual Basic:
  private m_Text as string = "MyDefaultValue"

  <Description("My Description"), DefaultValue("myDefaultValue")> _
  Public Shadows Property Text() As String
    Get
      Return m_Text
    End Get
    Set(ByVal value As String)
      m_Text = value
    End Set
  End Property

having something like
Visual Basic:
  <Description("My Description"), DefaultValue("myDefaultValue")> _
  Public Shadows Property Text() As String
    Get
      Return MyBase.Text
    End Get
    Set(ByVal value As String)
      MyBase.Text = value
    End Set
  End Property
and being able to set MyBase.Text to my default value as I am doing for m_Text.

Is that possible? and how can I do that initialization?
Thanks,
 
Back
Top