Results 1 to 4 of 4

Thread: [RESOLVED] Passing Program Startup Parameters To A Windows Program

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2006
    Posts
    121

    Resolved [RESOLVED] Passing Program Startup Parameters To A Windows Program

    How do I get the startup parameters passed to my WINDOWS program.

    I would like to pass parameters to my program such as this...

    myprogram.exe c:\mytextfile.txt

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Passing Program Startup Parameters To A Windows Program

    Are you asking how to pass them when you're debugging or how to retrieve them in code? If you're atlking about retrieving them in code use Environment.GetCommandLineArgs.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jan 2006
    Posts
    121

    Re: Passing Program Startup Parameters To A Windows Program

    i was wondering how to retrieve the args with code so the Enviroment.GetCommandLineArgs() worked

    Thanks again

  4. #4
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: [RESOLVED] Passing Program Startup Parameters To A Windows Program

    Also, they are passed to the static Main() method of your program's startup class.

    Code:
    static void Main(string[] args)
    {
      // ...
    }

Posting Permissions

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



Click Here to Expand Forum to Full Width