Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to bring up the "Windows cannot open this file" dialog?

My users can attach documents to various entities in the application. Of course, if user A attaches a .TIFF file, user B may not have a viewer for that type of file.

So I'd like to be able to bring up this dialog:

alt text http://www.angryhacker.com/toys/cannotopen.png

My application is C# with VS2005.
Currently I do Process.Start and pass in the file name. If no association is found, it throws an exception.

like image 309
AngryHacker Avatar asked May 19 '09 17:05

AngryHacker


1 Answers

Process pr = new Process();
pr.StartInfo.FileName = fileTempPath;
pr.StartInfo.ErrorDialog = true; // important
pr.Start();
like image 67
user199539 Avatar answered Oct 11 '22 08:10

user199539