Opening a File With its Default Program

July 1, 2010 | By

When developing a Windows Forms application you sometimes need to open a file using the default program associated with it automatically for the user view or edit it. This could be done by just calling the System.Diagnostics.Process.Start function and passing the file name and path as a string. It works with any file type as long as a default program is assigned to the file extension.

The following example opens a text file and an JPEG image:

Filed in: WinForms | Tags: ,

Comments are closed.