The following console program is the Visual Basic version of the traditional "Hello, World!" program, which displays the string "Hello, World!".
' A "Hello, World!" program in Visual Basic. Module Hello Sub Main() MsgBox("Hello, World!") ' Display message on computer screen. End Sub End ModuleThe important points of this program are the following:
- Comments
- The Main procedure
- Input and output
- Compilation and execution
Every Visual Basic application must contain a procedure called Main. This procedure serves as the starting point and overall control for your application. It is called when your module is loaded.
There are four varieties of Main:
- Sub Main()
- Sub Main(ByVal cmdArgs() As String)
- Function Main() As Integer
- Function Main(ByVal cmdArgs() As String) As Integer