Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Closing an application
Message
From
30/08/2011 09:46:09
 
 
To
30/08/2011 08:20:03
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01522144
Message ID:
01522252
Views:
28
>>Several things are not clear:
>>
>>(a) In the earlier thread you refer to this as a 'robot'. Does this mean you have a WinForms application which is engaged in running background tasks ? Any third party components involved ?
>
>Yes, this is a desktop application running visually on the desktop. No, there isn't any third party involved.
>
>>(b) You say 'When it is time to close the app. I call the Close() method". AFAIR in Winforms there are 'Application.Exit()' and Form.Close(). Which are you using ?
>
>I use Form.Close(). Is Application.Exist() safer?

>
>>(c) Can you post more detail on the exception ? FWIW it looks as if the error might be with the jit compiler which would imply that the code causing the exception had not previously been executed. You may get better information if you turn on JIT debugging:
>>http://msdn.microsoft.com/en-us/library/5hs4b7a6(v=vs.80).aspx
>>Note that, for WinForms you also need to set this directly in either the machine or application config.....
>
>Yes, it is from the JIT compiler. When the database flag is set to terminate the robot application, on the next timer loop, which is at every 60 seconds, before starting to execute all the tasks, it will check to see if the database flag is set to terminate the application. If yes, CloseForm() is called, which contains only one line, which is Close(). So, yes, in such a situation, that would be the first time that specific condition would be executed.

Assuming you've fired up the form using Application.Run(new WhateverForm()) then using WhateverForm.Close() to exit should be best.
But you mention a 'database flag' so what does your button click handler actually do ?
Are the tasks you speak of running in the same form ? Same thread ?
Is the forms OnClosing() and OnClosed() being called ?
If so does is the Application.ThreadExit event firing ?
IAC enabling JIT debugging is probably the way forward.........
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform