1849386 - How to clear and reload new report in the WPF Crystal Report Viewer

SAP Knowledge Base Article - Public

1849386 - How to clear and reload new report in the WPF Crystal Report Viewer

Symptom

  • Requirement:
    • View a report in the WPF viewer
    • Clear the viewer when finished viewing the report (viewer will be blank)
    • Display another report when required

Environment

  • SAP Crystal Reports, developer version for Microsoft Visual Studio
  • Microsoft Visual Studio 2010 / 2012

Resolution

  • Use the following code:
    {
        public Window1()
        {
            InitializeComponent();
            reportViewer.Owner = this;
            CrystalDecisions.CrystalReports.Engine.ReportDocument doc = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
            doc.Load(@"c:\reports\formulas.rpt");
     
            reportViewer.ViewerCore.Visibility = Visibility.Visible;
            reportViewer.ViewerCore.ReportSource = doc;          
        }
     
         private void button1_Click(object sender, RoutedEventArgs e)
        {
            reportViewer.ViewerCore.Visibility = Visibility.Hidden;
        }
    }

     

 

Keywords

crvs cr4vs 2010 2012 view blank close open , KBA , BI-DEV-NET-SDK , .NET SDK / COM SDK , Problem

Product

SAP Crystal Reports, developer version for Microsoft Visual Studio