Accepting external argument(s) in Form application

Hughng

Freshman
Joined
Jun 24, 2003
Messages
42
I am just wondering that how I can accept external arguments for a VB.NET form application. The project does not have the main sub routine so I can not get it from there.

Ex:

When user click on icon A it will call C:\Programs\Form1.exe
I would like to have icon B also call C:\Programs\Form1.exe -i -t or something like that. Can I do it with window from application?

Thank you very much for your help,


HN
 
Nice and Easy ...

Environment.GetCommandLine

e.g

you run myapp.exe -h

in vb.net

Visual Basic:
msgbox(Environment.GetCommandLine)
' Returns -h

You can of course use

Environment.GetCommandLineArgs()

Which is a array of the arguments

Andy
 
Thank you for your help. When I try to put the switch (-i) in the short cut path it keep telling me that it is not a valid path. Look like windows does not like the switch statement after their executable.

Ex:

C:\Programs\Form1.exe (FINE)
C:\Programs\Form1.exe -i (NOT WORKING)

Thank you.

Also, how do I cast the value of a constant (changing it after initialized).
 
Back
Top