dcsimg
December 2, 2016
Hot Topics:

Beginning ActiveX - Part 2

  • November 19, 2002
  • By John Percival
  • Send Email »
  • More Articles »

Enumerations, usually known as enums allow you to make full use to VB's auto-suggest features. They allow you to group constants together, so that VB will automatically suggest and complete when you set the value.

The enum must first be defined in the declarations section. You can manually specify values for each member, as shown for the Right member, or let VB automatically number them. The value assigned is either zero (if it is the first member), or 1 greater than the value of the immediately preceding membername (Phew!-Ed).

Public Enum eDirection
  Left
  Right = 1
  Up
  Down
End Enum

To use this enum, just declare the property as the name of the enum:

Public Property Get Direction() As eDirection
Direction = m_Direction
End Property

Public Property Let Direction(ByVal New_Direction As eDirection)
m_Direction = New_Direction
PropertyChanged "Direction"
End Property

That is all there is to it. Use of this feature often seperates a very good control from a professional looking control. You can use it on the borderstyle and backstyle porperties, as with VB's controls.





Page 4 of 7



Comment and Contribute

 


(Maximum characters: 1200). You have characters left.

 

 


Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

Sitemap | Contact Us

Thanks for your registration, follow us on our social networks to keep up-to-date
Rocket Fuel