0

In the windows application developed using VS13 (Windows 8.1) i am able to see the rdlc reports(Using report viewer). But when i try to view the report in xp machine , application is getting closed. I'm using subreports as well in my rdlc report. I do not know the exact problem but i feel this.reportViewer1.RefreshReport(); is where i am getting the issue. When i comment this.reportViewer1.RefreshReport(); and check in XP machine i do not see any data but application is not closing and i am able to see the report. I have developed all the reports with Microsoft.ReportViewer.Common.dll and Microsoft.ReportViewer.WinForms.dll of version 11. To make the application run on XP machine i have compiled the application and referred v10 dlls. I do not know if there is any issue here as well. Can anyone help with the issue?

This is the code behind of Report Viewer Form :

public KCForm21(XMLParameters objParams)
{
    gObjLog = AppLogWriter.Instance;
    gObjParams = objParams;
    InitializeComponent();
    this.Size = Screen.PrimaryScreen.WorkingArea.Size;
    DataTable dt = new DataTable();

    try
    {
        dtsurvey = new DataTable();
        DAClass obj = new DAClass();
        dt = obj.Win_Get_KC_Header(gObjParams);
        reportViewer1.ProcessingMode = ProcessingMode.Local;
        gObjLog.WriteToLog("KathaChangeForm21 - Before binding RDLC.");
        reportViewer1.LocalReport.ReportPath = AppDomain.CurrentDomain.BaseDirectory.ToString() + ConfigurationManager.AppSettings["ReportPath"].ToString().Trim() + "KathaChangeForm21.rdlc";
        gObjLog.WriteToLog("KathaChangeForm21 - After binding RDLC.");
        gObjLog.WriteToLog("RDLC Path : " + reportViewer1.LocalReport.ReportPath.ToString().Trim());
        reportViewer1.LocalReport.DataSources.Clear();
        ReportDataSource datasource = new ReportDataSource("DataSet1", dt);
        reportViewer1.LocalReport.DataSources.Clear();
        reportViewer1.LocalReport.DataSources.Add(datasource);
        dtsurvey = dt;
        this.reportViewer1.LocalReport.SubreportProcessing += new SubreportProcessingEventHandler(KCForm21SubReport);
        //this.reportViewer1.SetDisplayMode(DisplayMode.PrintLayout);
        //this.reportViewer1.ZoomMode = ZoomMode.Percent;
        //this.reportViewer1.ZoomPercent = 50;
        this.reportViewer1.RefreshReport();
        //reportViewer1.Refresh();
    }
    catch (Exception ex)
    {
        gObjLog.WriteToLog("KCForm21 : " + ex.Message);
    }
    finally
    {
        gObjLog = null;
    }
    //this.reportViewer1.RefreshReport();
}

public void KCForm21SubReport(object sender, SubreportProcessingEventArgs e)
{
    DAClass obj = new DAClass();
    gObjLog = AppLogWriter.Instance;

    try
    {
        if (count % 2 == 0)
        {

            DataTable dt = new DataTable();
            dt = obj.Win_Get_KC_OldOwn(gObjParams, dtsurvey.Rows[oldowncount]["land_code"].ToString());
            ReportDataSource subRptSource = new ReportDataSource("OldOwner", dt);
            e.DataSources.Add(subRptSource);
            oldowncount++;

        }

        else
        {
            DataTable dtNew = new DataTable();
            dtNew = obj.Win_Get_KC_NewOwn(gObjParams, dtsurvey.Rows[newowncount]["land_code"].ToString());
            ReportDataSource subRptSourceNew = new ReportDataSource("NewOwner", dtNew);
            e.DataSources.Add(subRptSourceNew);
            newowncount++;
        }
        count++;
    }
    catch (Exception ex)
    {
        gObjLog.WriteToLog("KCForm21SubReport : " + ex.Message);
    }
}
Yael
  • 1,566
  • 3
  • 18
  • 25
Rakesh
  • 119
  • 1
  • 2
  • 16
  • *"I do not know the exact problem but i feel ..."* - we are not feeling C# problems, we are debugging, tracing, asserting, logging them. Do you have exception logged? – Sinatr Aug 18 '17 at 12:18
  • @sinatr I am not getting any exception. Everything is working fine in locally but when i run the application in XP application is closing without giving any exception. – Rakesh Aug 18 '17 at 12:41
  • Probably due to [unhandled exception](https://stackoverflow.com/q/5762526/1997232). – Sinatr Aug 18 '17 at 12:45

0 Answers0