Maziar,
Application.Exit should work in this context though. However, you are
calling this from within a timer callback. Is this a windows forms timer,
or a timer from the timers namespace? It might be possible (I am not sure)
that the call to Applciation.Exit requires the call to be made on the UI
thread.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- nick(dot)paldino=at=exisconsulting<dot>com
"Maziar Aflatoun" <ma***@rogers.com> wrote in message
news:Ek********************@news02.bloor.is.net.ca ble.rogers.com...
I got... It's Environment.Exit(0);
thank you
Maz.
"Maziar Aflatoun" <ma***@rogers.com> wrote in message
news:eW********************@news02.bloor.is.net.ca ble.rogers.com... Hi everyone,
I'm writing an application that needs to quit when it encouters an
error. However, Application.Exit() doesn't do anything here. Does anyone know
why?
public bool timerenabled
{
get
{
bool timerenabled;
ManageXML XMLSettingFile = new ManageXML();
try
{
timerenabled =
Convert.ToBoolean(XMLSettingFile.ReadElementValue( "timerenabled"));
return timerenabled;
}
catch (System.Xml.XmlException eXML)
{
timerMonitor.Stop();
MessageBox.Show("Please check your setting.xml file and rerun the
application. Application now closing.\r\n" + eXML.Message );
Application.Exit();
}
return false;
}
}
Thank you
Maziar A.