How can I get args of Form program? In console application I can use args[]
but what about Form Application?
One simple way:
string[] args = Environment.GetCommandLineArgs();
Alternatively you could change the Main-call to include parameters (in Program.cs):
static void Main(string[] args)
{
You will then need to pass it into your Form, and change your form's constructor accordingly (assuming that's where you need the args
):
public Form1(string[] args)
{
You need to change the form constructor to accept an args parameter.
eg:
public void Form1(string[] args)
{
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With