Page 1 of 1

Save Prompt

Posted: Tue Jan 06, 2009 6:16 pm
by johnham
I have a custom save routine that I use to save the reports from the designer over to an SQL database. When I try to exit the designer a prompt comes up that says "Save Changes in Report.mrt?" and prompts "Yes", "No", or "Cancel".

Is there a way to customize the message on this prompt or is there a way to hook this event so that I can have it prompt with the proper information?


Save Prompt

Posted: Fri Jan 09, 2009 9:24 am
by Edward
Hi John,

Yes, it is possible to write your own code for saving of the report when user tries to close the Designer.

Please write your own custom saving routine in the following static event:

StiOptions.Engine.GlobalEvents.ClosingDesigner

Thank you.

Save Prompt

Posted: Tue Feb 03, 2009 10:15 am
by Edward
Hi John,

The code might be as follows:

Code: Select all

StiOptions.Engine.GlobalEvents.ClosingDesigner += new CancelEventHandler(GlobalEvents_ClosingDesigner);

void GlobalEvents_ClosingDesigner(object sender, CancelEventArgs e)
{
    if (MessageBox.Show("Close?", "ClosingEvent", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button1) != DialogResult.OK)
       e.Cancel = true;
    else
    {
       // This code prevents the "Save Changes in Report.mrt?" message, but you have to save the report.
       (sender as Stimulsoft.Report.Design.StiDesignerControl).Report.IsModified = false;
    }
}