PreviewControl doesn't work

I use this code for show report (i need my own form).
            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

  • edited 2:02AM
    Please? No idea?
  • edited 2:02AM
    Hello,

    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.

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.