Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WinForms > Editors (TextBox, MaskedEdit, SpinEditor, BrowseEditor, ColorBox) > RadTextBox Initial Text

Not answered RadTextBox Initial Text

Feed from this thread
  • ali avatar

    Posted on Sep 29, 2011 (permalink)

    Hello all,

    I have a custom radtextbox class called PosNegTB. Now i want to set the inital text value of that class to "0.00", this is the code i have for it:

    public sub new
    mybase.new
    mybase.text = "0.00"

    end sub

    but when i add this class onto my main form the text inside it is "PosNegTB". What am i doing wrong? Plz help.


    Thank you in advance

    Reply

  • Ivan Petrov Ivan Petrov admin's avatar

    Posted on Oct 3, 2011 (permalink)

    Hi Ali,

    Thank you for writing.

    As easy as it might seem this task is not so simple. You cannot change the default value of a property in a class that inherits from its owner. One solution for your task is to override the Text property and check whether the Site property is null and set the property only then. This means setting the property only when you are not at design time. This will allow you to set the property in the constructor but will prevent you from setting it at design time. If this is not a problem for you, here is the code for the property:

    Public Overrides Property Text As String
      Get
        Return MyBase.Text
      End Get
      Set(value As String)
        If Site Is Nothing Then MyBase.Text = value
      End Set
    End Property

    I hope this will help you. Should you have further questions, I would be glad to help. Greetings,
    Ivan Petrov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WinForms > Editors (TextBox, MaskedEdit, SpinEditor, BrowseEditor, ColorBox) > RadTextBox Initial Text
Related resources for "RadTextBox Initial Text"

[ Features | Demos | Documentation | Knowledge Base | Telerik TV | Code Library | Step-by-step Tutorial | Blogs | Self-Paced Trainer ]