Page 1 of 1

Getting the event when user close the preveiw report

Posted: Wed Apr 23, 2008 5:08 am
by ngaheer
Hi,

i m using the following code
report.Show(False)

my need is when user close the preview control(Window) i need a event which tells us the user clicks on close buttion.

Thanks,
Waiting ur reply

Getting the event when user close the preveiw report

Posted: Wed Apr 23, 2008 8:01 am
by Brendan
You can hook into the standard .net Form Closing Event (Closing or FormClosing depending on which version of .net you use)

Code: Select all

report.Render();
Stimulsoft.Report.Render.StiPreviewForm previewForm = new Stimulsoft.Report.Render.StiPreviewForm(report);
previewForm.Closing += new CancelEventHandler(previewForm_Closing);

previewForm.Show();



private void previewForm_Closing(object sender, CancelEventArgs e)
{
	if(MessageBox.Show("Close Preview?", "Preview Report", MessageBoxButtons.YesNo) == DialogResult.No)
		e.Cancel = true;
}