VB.NET Sub Keyword
Sub procedure is a function that do not return any value. Sub keyword is used to declare a sub procedure.
Sub keyword is used to declare a sub procedure. Sub procedure is a function that do not return any value. Sub main and End sub is default sub procedures, it starts execution of application automatically. Each time when the Sub procedure is called the statement executed until the matching End Sub is not found. If we use private with sub it means sub procedure is associated with an event. Sub used at module level.
Code
Imports System
Module Module1
Sub Main()
Console.WriteLine("Your are in Main! ")
Console.WriteLine("Press enter to call Method1")
Console.ReadLine()
Method1()
Console.WriteLine("Back in Main( ).")
Console.WriteLine("Press enter to call Method2")
Console.ReadLine()
Method2(40, 10.5)
Method2(38, 21.75)
Method2(20, 13)
Method2(50, 14)
Console.ReadLine()
End Sub
Sub Method1()
Console.WriteLine("Welcome in Method1")
Console.WriteLine("Press enter back to main")
Console.ReadLine()
End Sub
Sub Method2(ByVal value1 As Integer, ByVal value2 As Decimal)
Console.WriteLine("The payment is {0:C}", value1 * value2)
Console.WriteLine("Welcome in Method2")
End Sub
End Module
Output