Private - Visual Basic (original) (raw)

Specifies that one or more declared programming elements are accessible only from within their declaration context, including from within any contained types.

Remarks

If a programming element represents proprietary functionality, or contains confidential data, you usually want to limit access to it as strictly as possible. You achieve the maximum limitation by allowing only the module, class, or structure that defines it to access it. To limit access to an element in this way, you can declare it with Private.

Note

You can also use the Private Protected access modifier, which makes a member accessible from within that class and from derived classes located in its containing assembly.

Rules

Behavior

The Private modifier can be used in these contexts:

Class Statement

Const Statement

Declare Statement

Delegate Statement

Dim Statement

Enum Statement

Event Statement

Function Statement

Interface Statement

Property Statement

Structure Statement

Sub Statement

See also