"cashdeskmac" <ca*********@discussions.microsoft.com> wrote in message
news:9B**********************************@microsof t.com...
I want to detect when the users computer is going to close down so that I
can
write all unfinished data to a file before closing down. Does anyone know
how this is done?
Hello cashdeskmac,
Here's how I've done it in the past.
Create a class with a static constructor that will hold a Check.IsSaved
property:
public Check
{
static Check() {}
private string _isSaved = "";
public bool IsSaved
{
set { _isSaved = value; }
get { return _isSaved; }
}
// other static check values...
}
Whenever data has changed, change the IsSaved property to false.
Whenever a file is saved, change the IsSaved status to true.
Finally, check the IsSaved property when the application is about to close
and take the appropriate action/inaction.
Handlers on component and application events will make this a snap.
J. Buelna - Houston, TX