Jump to content

Getting at the command line?!


Guest Kallisti

Recommended Posts

Guest Kallisti

Right, the Command object doesn't work (it's there, just throws an exception if you try and use it in the compact framework), and Environment doesn't have any command line variables in it that I can find.

So how do I get at the command line arguments that I've included in the shortcut to my app?

Link to comment
Share on other sites

Guest Peter Foot

Use an overload of your sub Main which accepts an array of strings - which will receive your application arguments e.g.

public class Form1 : System.Windows.Forms.Form

{

static void Main(string[] args)

{

Application.Run(new Form1(args));

}

public Form1(string[] args)

{

InitializeComponent();

//setup your form stuff here and populate controls, fields etc using arguments as required

}

//other methods properties etc

}

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.