I have a form where I have created a custom property, DataEntryRole, and set its Browsable attribute to True, as shown:
<Browsable(True)> _
Public Property DataEntryRole() As UserRole.PossibleRoles
Get
Return mDataEntryRole
End Get
Set(ByVal value As UserRole.PossibleRoles)
mDataEntryRole = value
End Set
End Property
(UserRole.PossibleRoles is an Enum)
When I view the designer for my form, DataEntryRole doesn't appear in the property box. I assume that it should appear if I were to create another form that inherited from this base form, 开发者_JAVA百科but that's not what I want. I want this property to show up in my current form.
Is this possible? If so, how? If not, what in your opinion is a viable alternative?
In the end, I made a subclass of Form and added the properties I wanted to that subclass. I then set my form to inherit from that subclass and the properties now display in the properties box. I'm still curious about whether there is a way to do what I asked without making a Form subclass.
I believe the reason why your custom property isn't showing up in the Properties window is because you are using a custom enumeration. If you use primitive types (int, bool, string, etc.), then they show up because they are easily editable from within the Properties window.
精彩评论