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

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 =)

Popular posts from this blog

Example to disable save as certain file type in SSRS Report Viewer

Phone book application example - Java

Modal Popup Message Box ASP.NEt C# Example