HideModuleNameAttribute Class 

The HideModuleNameAttribute attribute, when applied to a module, allows the module members to be accessed using only the qualification needed for the module.

' Usage
<HideModuleName> Module moduleName
' Declaration
<System.AttributeUsage(System.AttributeTargets.Class, _
   Inherited := False, AllowMultiple := False)> _
Public NotInheritable Class HideModuleNameAttribute
   Inherits System.Attribute

Remarks

This attribute is useful for exposing module members without showing the module itself. When using IntelliSense in the Visual Studio Integrated Development Environment (IDE) for Visual Basic, the module does not show in the statement completion list. Instead, IntelliSense shows the module members.

Even when the module name is hidden, the module members are still accessible through the module.

If a member name conflicts with another identifier or with a member of another module with the HideModuleNameAttribute attribute, then the member does not show in IntelliSense at the level of the module.

Example

This example shows how to use the HideModuleNameAttribute attribute to add a Database object to My, which can be accessed through My.Database.

Namespace My
    <HideModuleName()> Module CustomMyDatabase
        Public ReadOnly Property Database() As MyDatabase
            Get
                Return databaseValue
            End Get
        End Property
        Private ReadOnly databaseValue As MyDatabase = New MyDatabase
    End Module
End Namespace

Class MyDatabase
    ' The members of the My.Database object go here.
End Class

The Namespace statement must appear outside of any classes or modules.

Requirements

Namespace: Microsoft.VisualBasic

Class: HideModuleNameAttribute

Assembly: Visual Basic Runtime Library (in Microsoft.VisualBasic.dll)

See Also

Reference

VBFixedArrayAttribute Class
VBFixedStringAttribute Class

Concepts

Attributes Used in Visual Basic

Other Resources

Attributes in Visual Basic