Here is how you can pass the command line args to the main form:
public class Form1 : System.Windows.Forms.Form
{
public string[] argApp;
// ...
public Form1(string[] arg)
{
argApp = arg;
// ...
}
static void Main(string [] arg)
{
Application.Run(new Form1(arg));
}
}
For a child form use references and Parent property to access the arguments stored in the main form.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.