PreviewControl doesn't work
I use this code for show report (i need my own form).
Repport will be shown without problem. But after I try to scroll in report with scroll bar, then report will dissapear.
Why?
            using (Report report = new Report())
            {
                Form form = new Form();
                PreviewControl preview = new PreviewControl();
                preview.Parent = form;
                preview.Dock = DockStyle.Fill;
                report.Preview = preview;
                report.Load(@"D:\MyReport.frx");
                report.RegisterData(MyDataTable, "MyTable");
                report.Prepare();
                report.ShowPrepared();
                form.WindowState = FormWindowState.Maximized;
                form.Show();
            }
Repport will be shown without problem. But after I try to scroll in report with scroll bar, then report will dissapear.
Why?
Comments
After you show the form, the report is disposed because of -
using (Report report = new Report()).
Either do form.ShowDialog() instead of form.Show(), or do not dispose the report until you close the preview form.