Results 1 to 3 of 3

Thread: Populate txtbox values on App1.exe with Command Line Arguments (sent from app2.exe)

  1. #1

    Thread Starter
    Addicted Member jalexander's Avatar
    Join Date
    Jan 2011
    Location
    Memphis, TN
    Posts
    160

    Exclamation Populate txtbox values on App1.exe with Command Line Arguments (sent from app2.exe)

    Ok so my App1.exe..closes itself when it's finished...after roughly 12 hours of doing it's task. It has 4 text box's on it. Those are the only things that need to be changed when it is "re-started" by the reloading program App2.exe later in the day

    People told me this can be done via command line arguments, saving me some time, so I am setting to work trying to figure that out tonight.

    What code will I need to add to App1.exe to accept command line arguments in order to fill txtbox1, 2, 3 & 4?
    And what code will I need to put in App2.exe to call App1.exe via the command line...with arguments to fill out the txtbox's of app1.exe at run-time

    More info....
    App1.exe is a Windows Form Application (with about 1,500 lines of code), it's not a command line program.
    App2.exe - the reloading program I'm working on...it can be whatever would be best for it's intended purpose...but currently it's just a little 120x120 Windows Form Application, with no code in it
    & finally...I don't yet know how to call on another .exe from within the code of a program, never done it before!
    dim jenn as geek = true
    Learning ~ Visual Basic 2010 ~ in free time between college/work -
    currently looking for a 'programming buddy' / 'coder friend' / and or 'mentor'. p.m. me if you
    have ANY free time AT ALL I'm like 33% of a novice level ~ willing 2 listen/learn +
    i am totally super motivated & promise to make an effffin amazing protege!!! #swag

    | -_-_- -_-_- |
    ...W.T..F!?.....
    ||| Matter on the atomic/quantum level isn't solid or even matter at all. It can also exist in at least 2 places simultaneously (demonstrated in lab). It's position can only be established when it's actually observed. If we turn our back on it... it goes back to a wave form. History show's that every previous generation (since the beginning of time) got almost everything wrong. Then it might very well stand to reason that up is down & right can be wrong. Admit it.. our combined perception of reality is just that, we know absolutely nothing of actual reality & to think we do is simply subscribing to a "ignorance is bliss" mantra |||

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

    Re: Populate txtbox values on App1.exe with Command Line Arguments (sent from app2.ex

    You can call Environment.GetCommandLineArgs anywhere you like, e.g. the Load event handler of your main form, to get the application commandline arguments in a String array. Note that the first element of that array will always be the name/path of the EXE itself, so the array will always have at least one element. You can simply get the other elements of that array and, after processing if necessary, assign them to the Text of a your TextBoxes.

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    Re: Populate txtbox values on App1.exe with Command Line Arguments (sent from app2.ex

    To start another process, call Process.Start. You can pass the path of the file you want to execute as an argument. If you want to pass commandline arguments to the new process then pass them as a single String to the second parameter of Process.Start.

Tags for this Thread

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