Results 1 to 7 of 7

Thread: Starting a program with a chosen path

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2009
    Posts
    5

    Starting a program with a chosen path

    ~~~~
    Last edited by cuvvvie; Nov 26th, 2010 at 08:56 PM.

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

    Re: Starting a program with a chosen path

    There's no need to set your app's CurrentDirectory.
    vb.net Code:
    1. Dim psi As New ProcessStartInfo(fileName)
    2.  
    3. psi.WorkingDirectory = folderPath
    4. Process.Start(psi)
    vb.net Code:
    1. Dim psi As New ProcessStartInfo(IO.Path.Combine(folderPath, fileName))
    2.  
    3. psi.UseShellExecute = False
    4. psi.WorkingDirectory = folderPath
    5. Process.Start(psi)
    One of those will do what you want, depending on what you're trying to achieve and how the app being started behaves. You just have to pass the correct folder path and file name.
    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
    New Member
    Join Date
    Nov 2009
    Posts
    5

    Re: Starting a program with a chosen path

    ~~~~
    Last edited by cuvvvie; Nov 26th, 2010 at 08:56 PM.

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

    Re: Starting a program with a chosen path

    Quote Originally Posted by cuvvvie View Post
    Yes there is
    No there isn't. That's what I have set the WorkingDirectory in my code examples for. It specifies the startup folder and/or current directory for the new process without your having to change the current directory for the current process.
    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

  5. #5

    Thread Starter
    New Member
    Join Date
    Nov 2009
    Posts
    5

    Re: Starting a program with a chosen path

    ~~~~
    Last edited by cuvvvie; Nov 26th, 2010 at 08:56 PM.

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

    Re: Starting a program with a chosen path

    Quote Originally Posted by cuvvvie View Post
    Oh, I thought you meant my original code , I understand that there is no need for it in the code you gave me.
    I meant exactly what I thought I meant. You must improve your mind-reading skills.
    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

  7. #7

    Thread Starter
    New Member
    Join Date
    Nov 2009
    Posts
    5

    Re: Starting a program with a chosen path

    ~~~~
    Last edited by cuvvvie; Nov 26th, 2010 at 08:56 PM.

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