c# forms app WITH args? possible?

  • Thread starter Thread starter S Moran
  • Start date Start date
S

S Moran

vs2005 pro
i have a c# windows forms based app that i need the ability to also start
from the run line (or command line) and pass args to. how can i do this?
 
Check declaration of static Main method, where you run your main form . It
can have arguments for parameters.

Sample code:

class TestApp
{
static void Main(string[] args)
{
System.Console.WriteLine(args.Length);
}
}

HTH
Alex
 
i need to write the args to a textbox on the form, but i cant access the
textbox from Main()
any ideas?



AlexS said:
Check declaration of static Main method, where you run your main form . It
can have arguments for parameters.

Sample code:

class TestApp
{
static void Main(string[] args)
{
System.Console.WriteLine(args.Length);
}
}

HTH
Alex
S Moran said:
vs2005 pro
i have a c# windows forms based app that i need the ability to also start
from the run line (or command line) and pass args to. how can i do this?
 
Hello,

you can use Environment.GetCommandLineArgs().

Kind regards,
Henning Krause

S Moran said:
i need to write the args to a textbox on the form, but i cant access the
textbox from Main()
any ideas?



AlexS said:
Check declaration of static Main method, where you run your main form .
It can have arguments for parameters.

Sample code:

class TestApp
{
static void Main(string[] args)
{
System.Console.WriteLine(args.Length);
}
}

HTH
Alex
S Moran said:
vs2005 pro
i have a c# windows forms based app that i need the ability to also
start from the run line (or command line) and pass args to. how can i do
this?
 
Just pass arguments to form ar use advice of Henning Krause (Environment
call).


S Moran said:
i need to write the args to a textbox on the form, but i cant access the
textbox from Main()
any ideas?



AlexS said:
Check declaration of static Main method, where you run your main form .
It can have arguments for parameters.

Sample code:

class TestApp
{
static void Main(string[] args)
{
System.Console.WriteLine(args.Length);
}
}

HTH
Alex
S Moran said:
vs2005 pro
i have a c# windows forms based app that i need the ability to also
start from the run line (or command line) and pass args to. how can i do
this?
 
Back
Top