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
Save Prompt
Thanks,
John Hamilton
Hamilton & Company, LLC
John Hamilton
Hamilton & Company, LLC
Save Prompt
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.
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
Hi John,
The code might be as follows:
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;
}
}