Doubleclick to open file

What you need is a place in your MyProgram.cs class to store the command line arguments received in the constructor (Main).
Something like public string SelectedFile;

In the Main constructor, do this:

public static void Main(string[] args)
{ string SelectedFile;
if (args.Length > 0)
SelectedFile = Convert.ToString(args[0]);
MessageBox.Show(SelectedFile); // Just to confirm it.

MyProgram app = new MyProgram();
app.SelectedFile = SelectedFile;

No comments:

Post a Comment