mcerk Posted April 6, 2005 Posted April 6, 2005 I'd like to create a property which can only have a few flags. Dim _stat As Integer Enum status As Integer DefaultStatus = 0 NotConnected = 1 Running = 2 Stopped = 3 Paused = 4 End Enum Private Property ChangeStatus() As Integer Get Return _stat End Get Set(ByVal ValueAs Integer) _stat = Value End Set End Property How can I achieve that you can only change to predefined status values? tx matej Quote
mskeel Posted April 6, 2005 Posted April 6, 2005 Change the type of the property to the name of you Enum... Private Property ChangeStatus() As Status Get Return _stat End Get Set(ByVal ValueAs Integer) _stat = Value End Set End Property Also, you don't need to type the Enum as an Integer. The default type is integer.. Further, Enums can only be of type Byte, Integer, Long, or Short. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.