Passing parameters on launch
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums
Results 1 to 2 of 2

Thread: Passing parameters on launch

  1. #1
    Join Date
    Jul 2013

    Passing parameters on launch


    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)

    if (args.Length < 1)

    Application.Run(new Form1());

    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.

  2. #2
    Join Date
    Jul 2001
    Sunny South Africa

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

This is a survey!

HTML5 Development Center