Hello!
I'm trying to get my program to automatically open a file when I doubleclick on it, I have set the file assosiation right but my code isn't working. I have read about the "Application.Run(new MyProgram());" but I have some problems.
When I 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.
Application.Run(new MyProgram(SelectedFile));
}
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MyProgram());
}
Thing is that I want to have futher use of the "SelectedFile" in my application.
I get the error "No overload for method 'MyProgram' takes '1' arguments" on the "Application.Run(new MyProgram(SelectedFile));" line.
Anyone know what to do?