Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Hide an enum from property browser

2 views
Skip to first unread message

Karl E. Peterson

unread,
Jun 22, 2009, 5:19:19 PM6/22/09
to

Hi Folks --

I know there's a way to hide an enum constant when it's used as a public property
type in a control. IOW, say you have:

Public Enum TheFruits
Apple = 0
Orange = 1
Plum = 2
End Enum

And you have a property:

Public Property Set Fruit(ByVal NewFruit As TheFruits)
' whatever
End Property

I'd like to do validity checking inside the Set, to make sure the passed value is in
range. I thought there was a way to stick a "private" value within the enum,
something like this:

Public Enum TheFruits
[_FruitFirst] = 0
Apple = 0
Orange = 1
Plum = 2
[_FruitLast] = 2
End Enum

Public Property Set Fruit(ByVal NewFruit As TheFruits)
If NewFruit >= [_FruitFirst] And NewFruit <= [_FruitLast] Then
' whatever
End If
End Property

But this "doesn't work" - the bracketed values show up in the property browser
dropdown for that property. Otherwise, it works. For instance, in the Intellisense
dropdown, the bracketed values are missing. Is there some trick I'm forgetting to
hide them in the Property browser?

Thanks... Karl
--
.NET: It's About Trust!
http://vfred.mvps.org


0 new messages