Freigeben über


Visual Basic Concepts

Adding Properties and Methods to Classes

The default interface of a class in your component is simply the set of all public properties, methods, and events in the class module, UserControl, or UserDocument that defines the class.

Adding properties and methods is easy — a method is any Public Sub or Public Function procedure you declare in the module that defines your class; a property is any public property procedure or public variable you declare.

The following related topics examine the issues you should be aware of when declaring interface elements in a component.

Important   The following names cannot be used as property or method names, because they belong to the underlying IUnknown and IDispatch interfaces: QueryInterface, AddRef, Release, GetTypeInfoCount, GetTypeInfo, GetIDsOfNames, and Invoke. These names will cause a compilation error.

For More Information*   The mechanics of property and method declaration are discussed in "Adding Properties to a Class" and "Adding Methods to a Class," in "Programming with Objects," in the *Visual Basic Programmer’s Guide.