Module MyModule
Public Sub GreetUser()
Console.WriteLine("Hello user...")
End Sub
End Module
Sub Main()
' Show banner.
DisplayBanner()
' Call the GreetUser() method in MyModule.
MyModule.GreetUser()
End Sub
Another trait of the module type is that it cannot be directly created using the VB 2010 New keyword (any
attempt to do so will result in a compiler error). Therefore, the following code is illegal:
' Nope! Error, can't allocate modules!
Dim m as New Module1()
Rather, a module simply exposes shared members
Comments
Post a Comment