Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer


The Friend keyword confers friend access on one or more declared programming elements. Friend elements are accessible from within the program that contains their declaration and from anywhere else in the same assembly.

The Friend keyword can be used in conjunction with the Protected keyword in the same declaration. This combination confers both friend and protected access on the declared elements, so they are accessible from the same assembly, from their own class, and from any derived classes.

The Friend keyword is used in these contexts:

Class Statement

Const Statement

Declare Statement

Delegate Statement

Dim Statement

Enum Statement

Event Statement

Function Statement

Interface Statement

Module Statement

Property Statement

Structure Statement

Sub Statement

See Also

Protected | Accessibility | Procedures | Structures: Your Own Data Types | Understanding Classes

© 2016 Microsoft