PDA

Click to See Complete Forum and Search --> : Program Parameters *SOLVED*


DJ_Catboy
Sep 3rd, 2003, 07:10 AM
[STAThread]
static void Main(string[] args)
{
int x = args.GetUpperBound(0);
if (x == -1) {
MessageBox.Show("No Parameters!");
} else {
Application.Run(new frmMain(args[0]));
}
}


I am trying to use command line parameters in my application but it does not work. Is there anything wrong with the code above?

Hope somebody can help!

DJ

Lethal
Sep 3rd, 2003, 11:17 AM
static void Main(string[] args) {
if (args.GetLength(0) > 0) {
Console.WriteLine(String.Format("We have args! - {0}", args[0]));
}
else {
Console.WriteLine("We do not have args!");
}
}

DJ_Catboy
Sep 3rd, 2003, 11:44 AM
Many thanks! Works like a charm!

DJ