How to design report with DesignerControl?

I use code like this. But designer will be show empty.
                Report report = new Report())
                Form form = new Form();
                DesignerControl designer = new DesignerControl();
                designer.Parent = form;
                designer.Dock = DockStyle.Fill;
                report.Designer = designer;
                report.Load(@"D:\MyReport.frx");
                report.RegisterData(MyDataTable, "MyTable");
                report.Prepare();
                report.Design();
                form.WindowState = FormWindowState.Maximized;
                form.Show();

Comments

  • edited September 2011
    Ok, I found problem.

    I need do this:
    designer.Report = report;
    
    instead of this:
    report.Designer = designer;
    

    Why it is in PreviewControl in opposite way that in Design control?
  • edited 2:12AM
    Hello,

    Try this:
                    Report report = new Report())
                    Form form = new Form();
                    DesignerControl designer = new DesignerControl();
                    designer.Parent = form;
                    designer.Dock = DockStyle.Fill;
                    report.Load(@"D:\MyReport.frx");
                    report.RegisterData(MyDataTable, "MyTable");
                    designer.Report = report;
                    form.WindowState = FormWindowState.Maximized;
                    form.Show();
    
  • edited September 2011
    to AlexTZ:
    Thank you for fast answer. Excatly hat was problem.
    Why it is different in preview control and designer control?

    Thank you.

Leave a Comment