Overridden property doesn't appear in Properties window 
Author Message
 Overridden property doesn't appear in Properties window

I have a user control with a Text property that is overridden so that I can
map it to a constituent control's Text property.  The problem is, the Text
property doesn't show up in the Properties window when I place my user
control on a form.  If I type in the name of the control in the form's code,
it will list Text as an available property, however.

Here's how things are declared:

Inherits System.Windows.Forms.UserControl

Private strText As String

Public Overrides Property Text() As String

    Get

        Return strText

    End Get

    Set(ByVal Value As String)

        strText = Value

        Label1.Text = strText

    End Set

End Property

What am I doing wrong?



Wed, 25 Aug 2004 05:09:24 GMT  
 Overridden property doesn't appear in Properties window
You need to set the Browsable attribute to true.  The browsable attribute
determins if the IDE can set your property at design time.

Look in System.ComponentModel for most of the Attributes pertaining to
UserControls.

In this instance change your property declaration to:-

<System.ComponentModel.Browsable(True)> _
Public Overrides Property Text() As String

Kind Regards
Steve Wright
MCSD



Wed, 25 Aug 2004 06:51:31 GMT  
 Overridden property doesn't appear in Properties window
Thanks very much!

Dave


Quote:
> You need to set the Browsable attribute to true.  The browsable attribute
> determins if the IDE can set your property at design time.

> Look in System.ComponentModel for most of the Attributes pertaining to
> UserControls.

> In this instance change your property declaration to:-

> <System.ComponentModel.Browsable(True)> _
> Public Overrides Property Text() As String

> Kind Regards
> Steve Wright
> MCSD



Fri, 27 Aug 2004 22:16:51 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Property window won't appear

2. Object Properties don't see in properties Window

3. ADO Help doesn't appear (Access 2000, Windows 2000)

4. A VB form doesn't appear in Windows taskbar

5. Crystal Report Window doesn't appear in client machines

6. UserControl properties don't appear in Object Browser

7. Object doesn't support this property or method : 'DTSGlobalVariables(...).Value.Open

8. How Can I Create a Property Windows Like VB5 Properties Window

9. Object doesn't support this property/method??????

10. Object doesn't support this property or method

11. Object doesn't support this property or method

12. Object doesn't support this property or method

 

 
Powered by phpBB® Forum Software