-
July 8th, 2013, 06:11 AM
#1
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.
-
July 8th, 2013, 11:14 AM
#2
Re: Passing parameters on launch
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|