The path to the file being opened is passed as a command line argument to your application. You need to read that argument and open the file from that path.
There are two ways to do this:
The easiest way is to loop through the values of the args array passed as the single parameter to the Main method:
static class Program
{
///
/// The main entry point for the application.
///
[STAThread]
static void Main(string[] args)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new FormMain());
}
}
The second way to do it is to use the Environment.GetCommandLineArgs method. This is useful if you want to extract the arguments at some arbitrary point within your application, rather than inside of the Main method.