Click here to Skip to main content
15,895,256 members
Home / Discussions / C#
   

C#

 
GeneralRe: How to get a string's encoding Pin
Matt Gerrans1-Nov-04 11:23
Matt Gerrans1-Nov-04 11:23 
GeneralRe: How to get a string's encoding Pin
Heath Stewart1-Nov-04 11:37
protectorHeath Stewart1-Nov-04 11:37 
GeneralCollection Class's Pin
MrJJKoolJ30-Oct-04 5:24
MrJJKoolJ30-Oct-04 5:24 
GeneralRe: Collection Class's Pin
Colin Angus Mackay31-Oct-04 1:58
Colin Angus Mackay31-Oct-04 1:58 
QuestionHow can i change the Form title bar color Pin
Zapss29-Oct-04 23:56
Zapss29-Oct-04 23:56 
AnswerRe: How can i change the Form title bar color Pin
Heath Stewart30-Oct-04 3:04
protectorHeath Stewart30-Oct-04 3:04 
GeneralUnload Pin
Anonymous29-Oct-04 23:05
Anonymous29-Oct-04 23:05 
GeneralRe: Unload Pin
Stefan Troschuetz30-Oct-04 0:15
Stefan Troschuetz30-Oct-04 0:15 
GeneralRe: Unload Pin
Heath Stewart30-Oct-04 3:19
protectorHeath Stewart30-Oct-04 3:19 
GeneralRe: Unload Pin
Heath Stewart30-Oct-04 3:25
protectorHeath Stewart30-Oct-04 3:25 
Generalconnection through proxy server Pin
Kamran Zafar29-Oct-04 22:35
Kamran Zafar29-Oct-04 22:35 
GeneralRe: connection through proxy server Pin
Heath Stewart30-Oct-04 4:01
protectorHeath Stewart30-Oct-04 4:01 
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 

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.