Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. MS ReportViewer Cause Application Error

MS ReportViewer Cause Application Error

Scheduled Pinned Locked Moved C#
helpworkspace
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kakarato
    wrote on last edited by
    #1

    I'm using VS2005 with MSAcsess and MS ReportViewer to genearate a report. It work perfectly in my development environment. When i try to deploy the application to Virtual PC with a clean environment, it work fine. The application will hang when user open the report form and close and reopen (sometime happen on the third time)again the report form. Below is the code. And also i found out if user close the form in PrintLayout Mode. I must cancel the report rendering in form close event. this.reportViewer1.CancelRendering(5000); Else the program will hanged forever when user click PrintLayout button. FormReport frm = new FormReport(); this.Cursor = Cursors.WaitCursor; try { frm.ShowReport(sqlStatement + frm2.QueryString + " " + order , reportName); frm.ShowDialog(); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { //frm.Dispose(); this.Cursor = Cursors.Default; } private void ShowReport(string reportName, ReportsDS reportDS) { if (reportDS.Report.Rows.Count < 1) { MessageBox.Show("No records found. Please import data into system."); this.Close(); } ReportDataSource reportDataSource = new ReportDataSource(); reportDataSource.Name = "ReportsDS_Report"; reportDataSource.Value = reportDS.Report; this.reportViewer1.LocalReport.ReportEmbeddedResource = reportName; this.reportViewer1.LocalReport.DataSources.Add(reportDataSource); this.reportViewer1.RefreshReport(); } private void FormReport_FormClosing(object sender, FormClosingEventArgs e) { try { this.reportViewer1.CancelRendering(5000); } catch (Exception ex) { MessageBox.Show(ex.Message); } }

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups