473,326 Members | 2,127 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Application doesn't quit

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.
Nov 15 '05 #1
2 1690
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.

Nov 15 '05 #2
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.


Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: BJ | last post by:
The application I have been developing is great except one flaw. When Windows NT shuts down, it doesn't send the Event to my application (if it did, it would close all of the open forms and kill an...
3
by: downwitch | last post by:
Greetings, I have an application which has recently gone from being one big piece of front-end code to being three, i.e. an mdb A that references an mda B and an mda C. (For what it's worth, in...
0
by: koumides | last post by:
I wrote a small program in C# that does some processing and then wait for an event. If the event occurs then it outputs some stuff and then quits. Now my question is that since I am gonna have that...
8
by: ChrisBowringGG | last post by:
When you use Application.Quit() on an Excel application, there can still be an instance of Excel running, as seen in Task Manager. You can try following the advice on MSDN: ...
6
by: Max | last post by:
I have the following code on a form that launches Microsoft Outlook and creates a new email message for the user: Outlook.Application oApp = new Outlook.Application(); Outlook.MailItem oMail...
3
by: rdemyan via AccessMonster.com | last post by:
Sometimes users (including myself) accidentally click on the application close icon in the application menu bar when they meant to just click on the 'X' for the form. Of course the app closes and...
7
by: Jay | last post by:
In my C# code, I'm attempting to display a message box then quit the win form application I'm writing if a certain type of error occurs when the application starts up. In the main form's...
2
by: Alan T | last post by:
private Interop.Word.Application _wordApp; What is the differences betwenn _wordApp.Quit(...) and _wordApp.Application.Quit(...) ?
9
by: Andy | last post by:
Just noticed something interesting in the above. If you have your program file set to "Compact on Close" in access 2007 (which is desirable when you have a larger program that frequently needs...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.