When executing a VB.NET application, the CLR will translate IL into x86 instructions and look for a method named Main.
And execute the program from this method. The Main method is also called the “entry point” of the program.
The entry method can take different forms:
1. Main method without parameters
Module Module1 Sub Main() Console.WriteLine("Hello World!") Console.Read() End Sub End Module
2. Main with parameters Method
Module Module1 Sub Main(ByVal Args() As String) Console.WriteLine("Hello VB.NET!") For Each arg As String In Args Console.WriteLine(arg) Next Console.Read() End Sub End Module
You can also use another way of writing
Module Module1 Sub Main() Console.WriteLine("Hello VB.NET!")'The first parameter obtained is the complete path name of the program For Each arg As String In Environment.GetCommandLineArgs( ) Console.WriteLine(arg) Next Console.Read() End Sub End Module