Home All Groups Group Topic Archive Search About

Starting a console application from parameters

Author
24 Mar 2006 11:08 AM
Fabri
I'm writing a Console Application and I would like to start it only if I
pass to it a param:

myapp.exe -s --> start
myapp.exe --> I write usage reference

How can i do this?

Any help appreciated.

Best regards.

--
fabri
Sei un italiano medio, di oltre trent'anni se:
Sai che il codice SYS64738 serviva per riavviare il Commodore 64 ed hai
cambiato almeno una mezza dozzina di joystick Quickshot I giocando a
Summer Games.
MKDS nick & friend Code:
Joker® - 055895 043343

Author
24 Mar 2006 2:24 PM
Herfried K. Wagner [MVP]
"Fabri" <n*@sp.am> schrieb:
> I'm writing a Console Application and I would like to start it only if I
> pass to it a param:
>
> myapp.exe -s --> start
> myapp.exe --> I write usage reference

\\\
Public Module Program
    Public Function Main(ByVal Args() As String) As Integer
        For Each Arg As String In Args
            MsgBox(Arg)
        Next Arg
        Application.Run(New MainForm())
        If...Then
            Return 0
        Else
            Return 1
        ...
        End If
    End Function
End Module
///

Select 'Sub Main' as startup object in the project properties.

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>