UserControl Text Property

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.
 
O

One Handed Man \( OHM - Terry Burns \)

Have you tried using a Default value on the Attribute?
 
B

BluDog

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
 

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