UserControl Text Property

  • Thread starter Thread starter BluDog
  • Start date Start date
B

BluDog

Hi

On a UserControl the text property is a nonbrowsable property in the
base class, therefore to make this property visible in the IDE you
have to override the property:

<Browsable(True)> Overrides Property Text() As String
Get
Return MyBase.Text
End Get
Set(ByVal Value As String)
MyBase.Text = Value
End Set
End Property

The problem with this is that every time the Control is rebuilt the
Test property is reset to a zero length string ("").

Does anyone know how to overcome this?

Cheers

Blu.
 
Have you tried using a Default value on the Attribute?

Have now...

<Browsable(True), DefaultValue(GetType(String), "Sample Text")> _
Public Overrides Property Text() As String
Get
Return MyBase.Text
End Get
Set(ByVal Value As String)
MyBase.Text = Value
End Set
End Property

....same problem.

Cheers

Blu
 
Back
Top