Dear All
I would like to add a confirmation pop up window with a "Are you sure you want to exit Open Dental" message when the user clicks on the "X" Exit button, how can I do that?
Alos, i want to do the same when the user clicks on the exit button of the patient edit form...
Please help, thanks
Confirmation message when exiting OD
Re: Confirmation message when exiting OD
Just put this at the top of the FormOpenDental_FormClosing method on FormOpenDental like so:
You can do something similar on FormPatientEdit
Code: Select all
private void FormOpenDental_FormClosing(object sender,FormClosingEventArgs e) {
DialogResult result = MessageBox.Show(Lan.g(this, "Are you sure you want to quit Open Dental?"), "", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
if (result == DialogResult.No) {
e.Cancel = true;
return;
}
try {
Computers.ClearHeartBeat(Environment.MachineName);
} catch { }
FormUAppoint.AbortThread();
//ICat.AbortThread
//earlier, this wasn't working. But I haven't tested it since moving it from Closing to FormClosing.
if (ThreadCommandLine != null) {
ThreadCommandLine.Abort();
}
}
Cheers,
Bill Starck, DDS
Big Idea Software, LLC
Developer, EASy(Electronic Anesthesia System) for Open Dental
TX, USA
Bill Starck, DDS
Big Idea Software, LLC
Developer, EASy(Electronic Anesthesia System) for Open Dental
TX, USA
-
- Posts: 74
- Joined: Fri Apr 02, 2010 2:26 pm
Re: Confirmation message when exiting OD
Perfect, that worked just great form me BUT, how can i achieve the same with the Patient Edit form?
Thanks;
Thanks;
Re: Confirmation message when exiting OD
Just stick this at the top of method FormPatientEdit_Closing like so:
Code: Select all
private void FormPatientEdit_Closing(object sender, System.ComponentModel.CancelEventArgs e) {
DialogResult result = MessageBox.Show(Lan.g(this, "Are you sure you want to close this window?"), "", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
if (result == DialogResult.No) {
e.Cancel = true;
return;
}
if(DialogResult==DialogResult.OK){
return;
}
if(IsNew){
//for(int i=0;i<RefList.Length;i++){
// RefAttaches.Delete(RefList[i]);
//}
Patients.Delete(PatCur);
}
}
Cheers,
Bill Starck, DDS
Big Idea Software, LLC
Developer, EASy(Electronic Anesthesia System) for Open Dental
TX, USA
Bill Starck, DDS
Big Idea Software, LLC
Developer, EASy(Electronic Anesthesia System) for Open Dental
TX, USA
-
- Posts: 74
- Joined: Fri Apr 02, 2010 2:26 pm
Re: Confirmation message when exiting OD
Thanks a lot for your help. I applied the above on the patient edit for as advised and it works perfectly BUT i get the same message when i click on the "OK"/"Cancel" buttons on the form, i only want this message to appear when i close the form or click 'Cancel" and not when clicking OK.
How can i do that?
How can i do that?
- jordansparks
- Site Admin
- Posts: 5410
- Joined: Sun Jun 17, 2007 3:59 pm
- Location: Salem, Oregon
- Contact:
Re: Confirmation message when exiting OD
Use a variable to keep track of when the user clicks ok or cancel. And then skip the message if they did so.
Jordan Sparks, DMD
http://www.opendental.com
http://www.opendental.com