R
richard.martino
I have an application in which the user can double click on a file
name and my code simply says:
System.Diagnostics.Process.Start(filename);
The operating system determines which application to use from the file
extension (e.g., *.txt starts `notepad`);
For files that have not been configured someplace in the operating
system, I get the exception:
"No application is associated with the specified file for this
operation"
Yes, I can try/catch the exception, then re-issue:
System.Diagnostics.Process.Start("rundll32.exe", "shell32.dll,
OpenAs_RunDLL " + filename);
but, I do not like using try/catch as regular programming style, just
for genuine exceptions.
How can I tell if the operating system already has a file extension
associated with an application before I even begin?
Thanks.
name and my code simply says:
System.Diagnostics.Process.Start(filename);
The operating system determines which application to use from the file
extension (e.g., *.txt starts `notepad`);
For files that have not been configured someplace in the operating
system, I get the exception:
"No application is associated with the specified file for this
operation"
Yes, I can try/catch the exception, then re-issue:
System.Diagnostics.Process.Start("rundll32.exe", "shell32.dll,
OpenAs_RunDLL " + filename);
but, I do not like using try/catch as regular programming style, just
for genuine exceptions.
How can I tell if the operating system already has a file extension
associated with an application before I even begin?
Thanks.