Sub Procedure in VB.NET

HTML clipboard

 Sub Procedures

Sub procedures are methods which do not return a value. Each time when the Sub procedure is called the statements within it are executed until the matching End Sub is encountered.

Starting Point Sub Main()

Sub Main(), the starting point of the program itself is a sub procedure. When the application starts execution, control is transferred to Main Sub procedure automatically which is called by default.

For example

Module Module1

    Sub Main()

        Console.WriteLine("This is a Main! ")


        Console.WriteLine("control Back in Main( ).")

    End Sub 'Main


    Sub SomeMethod()

        Console.WriteLine(" From method!")

    End Sub

End Module