By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,087 Members | 1,513 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,087 IT Pros & Developers. It's quick & easy.

Process.StartInfo

P: n/a
After using a OpenFileDialog to locate a file within
Visual Studio.Net, A System.Diagnostics.Process is created
and the file information set using StartInfo. The process
returns an error indicating the File cannot be found
although the file is available and the working directory
has been set. If the OpenFileDialog is not used and the
path to the file is set directly the process is started
and works fine. This is repeatable and fails every time.
It appears to be a bug. Any suggestions would be
appreciated.
Jul 19 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hi Richard,

The following code worked for me:

OpenFileDialog ofd = new OpenFileDialog();
ofd.ShowDialog();

ProcessStartInfo startInfo = new ProcessStartInfo(ofd.FileName);
Process proc = Process.Start(startInfo);

proc.WaitForExit();

This allowed me to select a file using the Open File dialog, and then it
correctly launched the process. Could you post the snippet of code that
you're using, which is causing a problem?

Thanks,
Rajeev
Visual Studio .NET
Microsoft Corp.

This posting is provided "AS IS" with no warranties, and confers no rights.

Jul 19 '05 #2

P: n/a
Thanks for the reply,

The exact same code does not work on my machine. If I do the
ProcessStartInfo without doing the OpenFileDialog first (hard coding the
path), it works. I'm using .Net Framework v1.0.3705

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.