want to test when os is shutting down

T

Terry

Hello:
In vb.net - dot.net 2.0
I have a windows form app that on the Me.FormClosing event, I do an e.cancel

This results in the OS not shuting down or rebooting until the my app has
exited - which is a manual process.

What I want is:
1) check is the OS has initiated the Me.formclosing and if so, jump over the
e.cancel

When I shutdown the OS,
MsgBox(System.Environment.HasShutdownStarted.ToString) returns false

What do you suggest

Thank you

T
 
S

Scott Seligman

Terry said:
What I want is:
1) check is the OS has initiated the Me.formclosing and if so, jump over the
e.cancel

Check e.Reason to see if it equals CloseReason.WindowsShutDown
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top