Passing parameters on launch
Hi,
I am writing a windows form application that will pass parameters on lauch. If the parameter length is <1 the program will run as default, otherwise if the length is greater I want to create a hardcoded variable to use globally. Can someone please let me understand how to do this?
Here is what I would like to do, but is not working as expected:
static void Main(string[] args)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
if (args.Length < 1)
{
Application.Run(new Form1());
}
else
{
Form1 frmForm1 = new Form1();
MyVariable = "Test";
}
In this case, I would like to use "MyVariable" to help make decisions later in the application.
Thank you in advance.
Re: Passing parameters on launch