Using command line parameters in forms

  • Thread starter Thread starter Erik Wikström
  • Start date Start date
E

Erik Wikström

This is probably a stupid question but is there any easy way to
get the command line parameters in a windows form?
As it is now I copy the parameters into a statis string array
belonging to the form but I'm quite sure that it's not the
"right" way to do it.
 
Erik,
Another option would be to define a constructor in the form that accepted
the parameters, you would still need the default constructor for the forms
designer.

Alternately System.Environment has a CommandLine property & a
GetCommandLineArgs function that return either the command line string
(CommandLine) or the string parsed into an array (GetCommandLineArgs).

Hope this helps
Jay
 
Jay B. Harlow said:
Erik,
Another option would be to define a constructor in the form that accepted
the parameters, you would still need the default constructor for the forms
designer.

Alternately System.Environment has a CommandLine property & a
GetCommandLineArgs function that return either the command line string
(CommandLine) or the string parsed into an array (GetCommandLineArgs).

Hope this helps
Jay

Thanks a lote
Exactly what I needed.
 
Back
Top