Monday, 16 December 2013

How to open file using their default external viewer - C#

Leave a Comment
When write the application, some of the activity is to create file, convert file, etc . After create the file, the program should prompt user to open the created file using their respective default external viewer . Letsay you create .pdf file, so the default application to open the file is Adobe Reader .

The example will ask user is either user want to open file or not, if user agreed to open the file created, then the application will open file using their respective default external viewer depend on the file extension .

The code

   string outFilePath = File.Create("PDFFILE.pdf");                            
   DialogResult dr = MessageBox.Show("Open the rendered file in an external viewer?", "Open Rendered File", MessageBoxButtons.YesNo);
   if (dr == DialogResult.Yes)
   {
      System.Diagnostics.Process.Start(outFilePath);
   }


By
NOTE : – If You have Found this post Helpful, I will appreciate if you can Share it on Facebook, Twitter and Other Social Media Sites. Thanks =)

0 comments:

Post a Comment

Subscribe to our newsletter to get the latest updates to your inbox.

Your email address is safe with us!




Founder of developersnote.com, love programming and help others people. Work as Software Developer. Graduated from UiTM and continue study in Software Engineering at UTMSpace. Follow him on Twitter , or Facebook or .



Powered by Blogger.