Click here to Skip to main content
16,006,749 members
Home / Discussions / C#
   

C#

 
GeneralRe: Form.Close() Pin
exhaulted20-Sep-04 1:32
exhaulted20-Sep-04 1:32 
Generalmainly p.s. Pin
yoaz20-Sep-04 2:01
yoaz20-Sep-04 2:01 
GeneralRe: mainly p.s. Pin
exhaulted20-Sep-04 3:09
exhaulted20-Sep-04 3:09 
GeneralRe: mainly p.s. Pin
Charlie Williams20-Sep-04 5:00
Charlie Williams20-Sep-04 5:00 
GeneralRe: mainly p.s. Pin
exhaulted20-Sep-04 5:17
exhaulted20-Sep-04 5:17 
GeneralRe: Form.Close() Pin
Salil Khedkar20-Sep-04 2:10
Salil Khedkar20-Sep-04 2:10 
GeneralRe: Form.Close() Pin
exhaulted20-Sep-04 3:15
exhaulted20-Sep-04 3:15 
GeneralRe: Form.Close() Pin
Heath Stewart20-Sep-04 6:55
protectorHeath Stewart20-Sep-04 6:55 
There is no OnEndSession method to override.

There is, however, the SystemEvents.SessionEnding event that you can handle. This works for all currently released versions of .NET, as well as the upcoming 2.0 Framework:
SystemEvents.SessionEnding += new SessionEndingEventHandler(OnSessionEnding);
// ...
private void OnSessionEnding(object sender, SessionEndingEventArgs e)
{
  // In your case, you probably don't care about the <code>e.Reason</code>
}
Implement your code in the handler, but do it fast. If you don't, your application will appear hung and Windows will prompt the user to kill it, which could leave your application data in an unsuitable state.

This posting is provided "AS IS" with no warranties, and confers no rights.

Software Design Engineer
Developer Division Sustained Engineering
Microsoft

[My Articles]
GeneralRe: Form.Close() Pin
exhaulted20-Sep-04 22:22
exhaulted20-Sep-04 22:22 
GeneralRe: Form.Close() Pin
Salil Khedkar20-Sep-04 23:30
Salil Khedkar20-Sep-04 23:30 
GeneralRe: Form.Close() Pin
exhaulted21-Sep-04 4:11
exhaulted21-Sep-04 4:11 
GeneralRe: Form.Close() Pin
Heath Stewart21-Sep-04 5:28
protectorHeath Stewart21-Sep-04 5:28 
GeneralRe: Form.Close() Pin
exhaulted21-Sep-04 6:23
exhaulted21-Sep-04 6:23 
GeneralRe: Form.Close() Pin
Heath Stewart21-Sep-04 6:37
protectorHeath Stewart21-Sep-04 6:37 
GeneralRe: Form.Close() Pin
exhaulted21-Sep-04 22:44
exhaulted21-Sep-04 22:44 
GeneralRe: Form.Close() Pin
Heath Stewart22-Sep-04 6:57
protectorHeath Stewart22-Sep-04 6:57 
GeneralRe: Form.Close() Pin
yoaz20-Sep-04 2:56
yoaz20-Sep-04 2:56 
GeneralRe: Form.Close() Pin
exhaulted20-Sep-04 3:10
exhaulted20-Sep-04 3:10 
GeneralRe: Form.Close() Pin
Nicholas Cardi20-Sep-04 4:50
Nicholas Cardi20-Sep-04 4:50 
GeneralRe: Form.Close() Pin
exhaulted20-Sep-04 6:16
exhaulted20-Sep-04 6:16 
GeneralRe: Form.Close() Pin
Nicholas Cardi20-Sep-04 7:59
Nicholas Cardi20-Sep-04 7:59 
GeneralRe: Form.Close() Pin
Nicholas Cardi20-Sep-04 8:07
Nicholas Cardi20-Sep-04 8:07 
GeneralData Table From DataRow[] Pin
sreejith ss nair19-Sep-04 22:50
sreejith ss nair19-Sep-04 22:50 
GeneralRe: Data Table From DataRow[] Pin
Sendilkumar.M20-Sep-04 1:52
Sendilkumar.M20-Sep-04 1:52 
GeneralRe: Data Table From DataRow[] Pin
sreejith ss nair20-Sep-04 17:35
sreejith ss nair20-Sep-04 17:35 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.