B Bob Nov 4, 2003 #1 It should be simple, but I'm stuck on this one... how do you return a value for an enum property type? TIA, Bob
It should be simple, but I'm stuck on this one... how do you return a value for an enum property type? TIA, Bob
A Armin Zingler Nov 4, 2003 #2 Bob said: It should be simple, but I'm stuck on this one... how do you return a value for an enum property type? Click to expand... I'm not sure if this is what you are looking for: Property MyProp() As FormBorderStyle Get Return FormBorderStyle.None End Get Set(ByVal Value As FormBorderStyle) End Set End Property (the example doesn't make sense but it shows...)
Bob said: It should be simple, but I'm stuck on this one... how do you return a value for an enum property type? Click to expand... I'm not sure if this is what you are looking for: Property MyProp() As FormBorderStyle Get Return FormBorderStyle.None End Get Set(ByVal Value As FormBorderStyle) End Set End Property (the example doesn't make sense but it shows...)
B Bob Nov 4, 2003 #3 An example to clarify: Public ReadOnly Property SomeEnum() As System.Enum Get 'How do I return RandomEnum ??? End Get End Property Public Enum RandomEnum member1 member2 End Enum Bob
An example to clarify: Public ReadOnly Property SomeEnum() As System.Enum Get 'How do I return RandomEnum ??? End Get End Property Public Enum RandomEnum member1 member2 End Enum Bob
A Armin Zingler Nov 4, 2003 #4 Bob said: An example to clarify: Public ReadOnly Property SomeEnum() As System.Enum Get 'How do I return RandomEnum ??? Click to expand... I don't know whether I understand your problem: Return RandomEnum.member1 End Get End Property Public Enum RandomEnum member1 member2 End Enum Click to expand... But, why don't you declare the property this way? Public ReadOnly Property SomeEnum() As RandomEnum This also enables intellisense after typing "return "
Bob said: An example to clarify: Public ReadOnly Property SomeEnum() As System.Enum Get 'How do I return RandomEnum ??? Click to expand... I don't know whether I understand your problem: Return RandomEnum.member1 End Get End Property Public Enum RandomEnum member1 member2 End Enum Click to expand... But, why don't you declare the property this way? Public ReadOnly Property SomeEnum() As RandomEnum This also enables intellisense after typing "return "
B Bob Nov 4, 2003 #5 I don't want to return an Enum member. I want to return the Enum itself. But I guess I'll be stuck with returning its type instead. Oh well. Bob
I don't want to return an Enum member. I want to return the Enum itself. But I guess I'll be stuck with returning its type instead. Oh well. Bob
C Crirus Nov 4, 2003 #6 Return RandomEnum.member1 will return 0 Return RandomEnum.member2 will return 1 You want to return the enum itself? You can refer to it's elements from the class where you design it?
Return RandomEnum.member1 will return 0 Return RandomEnum.member2 will return 1 You want to return the enum itself? You can refer to it's elements from the class where you design it?
A Armin Zingler Nov 4, 2003 #7 Bob said: I don't want to return an Enum member. I want to return the Enum itself. But I guess I'll be stuck with returning its type instead. Oh well. Click to expand... The Enum itself *is* a type, so you can Return GetType(RandomEnum) and change the property type to "As System.Type"
Bob said: I don't want to return an Enum member. I want to return the Enum itself. But I guess I'll be stuck with returning its type instead. Oh well. Click to expand... The Enum itself *is* a type, so you can Return GetType(RandomEnum) and change the property type to "As System.Type"