g_johnson
asked on
Application won't close ...
The code below comes from an application that currently runs just like any other Windows program. It's written in C#, VS 2008, for the .Net 2.0 framework.
I need to add functionality such that if it is started with a command line argument, it is run unattended, i.e., it is not visible, goes directly to the method normally called by a click on a button, then shuts down.
I can't get it to shut down. When I put Application.Exit(); after this.ReportProduction(); it still does not shut down.
What should I do?
I need to add functionality such that if it is started with a command line argument, it is run unattended, i.e., it is not visible, goes directly to the method normally called by a click on a button, then shuts down.
I can't get it to shut down. When I put Application.Exit(); after this.ReportProduction(); it still does not shut down.
What should I do?
public frmMain(string [] args)
{
InitializeComponent();
if (args.Length != 0)
{
//running from scheduler
this.btnNow.Visible = false;
this.Opacity = 0;
this.ShowInTaskbar = false;
//every place that statlab or statlab2 is referenced while reporting production
// is inapproriate if unattended, and need to write to a log file instead
this._Unattended = true;
this.ReportProduction();
}
}
Hard to say without seeing the rest of the code. You must have a thread still running
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks -- kill worked