• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 13. Exploiting the Power of Clas... > Working with Enumerated Types

Working with Enumerated Types

By now, you should be quite familiar with Intellisense and its benefits. One benefit is that when you type the name of a property or a method whose value should be set to one of a set of constants, the list of appropriate constants automatically appears. For example, when using the OpenForm method of the DoCmd object, a list of six intrinsic constants appears for the View parameter. Using enumerated types, you can benefit from this behavior with your own custom properties and methods.

Here's how it works: For the custom PersonType property, imagine that only four values are appropriate: Client, PersonalContact, Vendor, and Other. Using an enumerated type, you can easily set it up so that the four appropriate types appear in a list whenever you set the PersonType property of the class. Use the Enum keyword to define an enumerated type:


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint