Save Prompt

Stimulsoft Reports.NET discussion
Post Reply
johnham
Posts: 98
Joined: Fri Sep 19, 2008 2:27 pm
Location: Richland, WA, USA

Save Prompt

Post 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?

Thanks,
John Hamilton
Hamilton & Company, LLC
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

Save Prompt

Post 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.
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

Save Prompt

Post 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;
    }
}
Post Reply