Reading command line arguments

Hi,

How can I receive command line arguments in VB.net ?
I want to recieve the string arguments and based on the argument I want to make certain buttons on my windows form visible or invisible.

Thanks,

[227 byte] By [bilalso] at [2007-12-17]
# 1

This should help

Public 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("<-no arguments passed->")

Else 'We have some arguments

Dim i As Integer = 0

While i < sArgs.Length 'So with each argument

Console.WriteLine("Argument" & ctype(i, string) & " " & sArgs(i) ) 'Print out each item

i = i + 1 'Increment to the next argument

End While

End If

End Sub


spotty at 2007-9-9 > top of Msdn Tech,Windows Forms,Windows Forms General...
# 2
The arguments are also available with the Environment.GetCommandLineArgs method. There's no need to change the Main method this way.
DanielRieck at 2007-9-9 > top of Msdn Tech,Windows Forms,Windows Forms General...