Link to home
Start Free TrialLog in
Avatar of fattumsdad
fattumsdad

asked on

One More Question On Args

I have the following code in a Windows Application:

static void Main(string[] args)
{
     if(args.Length > 0)
     {
          if(args[0].ToLower() == "-a")
          {
               Application.Run(new Form1());
          }
          else
          {
              Application.Run(new Form2());
          }
               
     }
}

If I put the "-a" in the command line (windowsapplication2.exe -a) it launches fine...  however, if I leave the "-a" off, the app won't launch.  Is there something wrong with me "else" statement.  
ASKER CERTIFIED SOLUTION
Avatar of Callandor
Callandor
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial