Click here to Skip to main content
15,909,091 members
Home / Discussions / C#
   

C#

 
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 
GeneralRe: Form.Close() Pin
exhaulted20-Sep-04 22:22
exhaulted20-Sep-04 22:22 
Well it sounded good but i still have the problem of the Close() method being called by windows when i attempt to log off or shut the PC down.

my code in the OnSessionEnding method is as follows
SaveSchedules();
Application.Exit(); //Bypasses the form.Close() method

Thats it, nice and quick. But, when the form is closing a call is made to CheckPassword() which is what is causing the problem. The end user will not know the password so they cant shut the scheduler down while the pc is running. If they log off / shut down the pc then i want the application to exit without checking the password.

Below is the offending event handler
private void Form1_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
//Write the details
SaveSchedules();

//Check for the password
if (!(CheckPassword()))
e.Cancel = true;
else
//Hide the notify icon
notifyIcon.Visible = false;
}

Thanks for all your help

Kev
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 
GeneralRe: Data Table From DataRow[] Pin
Sendilkumar.M20-Sep-04 18:27
Sendilkumar.M20-Sep-04 18:27 

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.