
This parameter holds the value to be assigned to the property. If you do not supply a parameter for Set, the integrated development environment (IDE) uses an implicit parameter named value. Visual Basic passes a parameter to the Set procedure during property assignments. You can adjust a property's access level with an access modifier on the Property statement, and you can optionally adjust one of its property procedures to a more restrictive access level. For more information, see Declaration Contexts and Default Access Levels.īy default, properties use public access. This means the declaration context for a property must be a class, structure, module, or interface, and cannot be a source file, namespace, procedure, or block. You can use Property only at class level. For more information, see Auto-Implemented Properties. You can omit the Get and Set procedure when using an auto-implemented property. A property can have a Get procedure (read only), a Set procedure (write only), or both (read-write).

The Property statement introduces the declaration of a property. Terminates the definition of this property. The Set statement is not used with auto-implemented properties. Starts a Set property procedure that is used to store the value of the property. Required if the property is marked WriteOnly. Block of statements to run within the Get or Set procedure. The Get statement is not used with auto-implemented properties.

Starts a Get property procedure that is used to return the value of the property. Required if the property is marked ReadOnly. Name by which the property is defined in interface. Name of an interface implemented by this property's containing class or structure. Implementedproperty Įach implementedproperty has the following syntax and parts: Indicates that this property implements one or more properties, each one defined in an interface implemented by this property's containing class or structure. Data type of the value returned by this property. List of local variable names representing the parameters of this property, and possible additional parameters of the Set procedure. Optional on the Property statement and on at most one of the Get and Set statements.

If you declare the property as Default, you cannot use Private on the property or on either of its property procedures. Default properties must accept parameters and can be set and retrieved without specifying the property name. Specifies that this property is the default property for the class or structure on which it is defined. List of attributes that apply to this property or Get or Set procedure. Declares the name of a property, and the property procedures used to store and retrieve the value of the property.
