Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to pass command line argument in the form

Status
Not open for further replies.

fivers

Programmer
Nov 4, 2003
3
PH
how do you pass a command line argument to Form_Load? that command line argument will then be displayed in a label.
 
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.


-obislavu-
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top