Click here to Skip to main content
15,887,135 members
Home / Discussions / C#
   

C#

 
GeneralMdiWindowListItem in C# express beta Pin
benjymous29-Oct-04 21:04
benjymous29-Oct-04 21:04 
GeneralRe: MdiWindowListItem in C# express beta Pin
Heath Stewart30-Oct-04 3:51
protectorHeath Stewart30-Oct-04 3:51 
GeneralRe: MdiWindowListItem in C# express beta Pin
benjymous30-Oct-04 23:08
benjymous30-Oct-04 23:08 
GeneralRe: MdiWindowListItem in C# express beta Pin
Heath Stewart31-Oct-04 9:19
protectorHeath Stewart31-Oct-04 9:19 
GeneralStrange compile error Pin
steve_rm29-Oct-04 20:14
steve_rm29-Oct-04 20:14 
GeneralRe: Strange compile error Pin
Heath Stewart30-Oct-04 3:47
protectorHeath Stewart30-Oct-04 3:47 
Generalprocess.start problem Pin
Karl 200029-Oct-04 19:50
Karl 200029-Oct-04 19:50 
GeneralRe: process.start problem Pin
Heath Stewart30-Oct-04 3:45
protectorHeath Stewart30-Oct-04 3:45 
And what exception handling do you have around Process.Start? Are you just catching exceptions and not doing anything with the exception data (like displaying a user-friendly error, which is the least you should do)?

Process.Start - the way you're calling it - uses ShellExecuteEx, the same API that the Windows Shell uses when you double-click files. There's really no difference.

So then you should ask yourself what the other factors may be. Are you expecting that the current working directory will be the directory in which the EXE is located? This doesn't have to be the case. The working directory can be any directory.

So, if this was some sort of help file and you expected it to be in the same directory as your application, then you should construct the fully-qualified path using either the Assembly.Location property or Application.StartupPath like so:
string path = Path.GetDirectoryName(Application.StartupPath);
path = Path.Combine(path, "help.pdf");
Process.Start(path);


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

Software Design Engineer
Developer Division Sustained Engineering
Microsoft

[My Articles] [My Blog]
GeneralRe: process.start problem Pin
Karl 200030-Oct-04 9:23
Karl 200030-Oct-04 9:23 
GeneralRe: process.start problem Pin
Heath Stewart30-Oct-04 15:40
protectorHeath Stewart30-Oct-04 15:40 
GeneralRe: process.start problem Pin
Karl 20001-Nov-04 2:50
Karl 20001-Nov-04 2:50 
Generalabout dynamic image in the richtextbox Pin
oldhawkiu29-Oct-04 19:38
oldhawkiu29-Oct-04 19:38 
GeneralRe: about dynamic image in the richtextbox Pin
oldhawkiu31-Oct-04 14:15
oldhawkiu31-Oct-04 14:15 
GeneralHelp On A Oracle Insert Statement Pin
macsgirl29-Oct-04 17:03
macsgirl29-Oct-04 17:03 
GeneralRe: Help On A Oracle Insert Statement Pin
Dave Kreskowiak29-Oct-04 18:53
mveDave Kreskowiak29-Oct-04 18:53 
GeneralRe: Help On A Oracle Insert Statement Pin
macsgirl29-Oct-04 18:56
macsgirl29-Oct-04 18:56 
GeneralRe: Help On A Oracle Insert Statement Pin
Heath Stewart30-Oct-04 3:39
protectorHeath Stewart30-Oct-04 3:39 
GeneralRe: Help On A Oracle Insert Statement Pin
Alex Korchemniy29-Oct-04 20:50
Alex Korchemniy29-Oct-04 20:50 
GeneralRe: Help On A Oracle Insert Statement Pin
macsgirl29-Oct-04 21:15
macsgirl29-Oct-04 21:15 
Generalplay video in windows form Pin
machocr29-Oct-04 10:42
machocr29-Oct-04 10:42 
GeneralRe: play video in windows form Pin
Heath Stewart30-Oct-04 3:36
protectorHeath Stewart30-Oct-04 3:36 
Generalsockets Pin
great_joe_8529-Oct-04 10:27
great_joe_8529-Oct-04 10:27 
GeneralRe: sockets Pin
Alex Korchemniy29-Oct-04 20:54
Alex Korchemniy29-Oct-04 20:54 
QuestionSetting return code in console app? Pin
LongRange.Shooter29-Oct-04 10:15
LongRange.Shooter29-Oct-04 10:15 
AnswerRe: Setting return code in console app? Pin
Heath Stewart30-Oct-04 3:30
protectorHeath Stewart30-Oct-04 3:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.