Visual Basic Example 2
By: a guest | Apr 12th, 2010 | Syntax:
VB.NET | Size: 0.82 KB | Hits: 143 | Expires: Never
Module Module1
Sub Main(ByVal sArgs() As String)
'Note the declaration of the Sub Main line
'It has the sArgs parameter. This parameter is handled by
'the system, and contains any command line arguments.
If sArgs.Length = 0 Then 'If there are no arguments
Console.WriteLine("Hello World! <-no arguments passed->") 'Just output Hello World
Else 'We have some arguments
Dim i As Integer = 0
While i < sArgs.Length 'So with each argument
Console.WriteLine("Hello " & sArgs(i) & "!") 'Print out each item
i = i + 1 'Increment to the next argument
End While
End If
Console.ReadLine()
End Sub
End Module