Click here to Skip to main content
16,018,818 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have created a main report and attached a subreport to it. It's working fine in visual studio 2010. When i click main report preview it shows all the details correctly. Bt if i trying to attach it a windows form it shows a message "An Error occured while adding a Strongly typed report document.....".
How to attach this report in c#.
Following is my code part....
C#
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
using System.Data.SqlClient;

namespace WindowsFormsApplication1
{
    public partial class payment_w_opb : Form
    {
        
        public payment_w_opb()
        {
            InitializeComponent();
        }

        private void crystalReportViewer1_Load(object sender, EventArgs e)
        {


        }

        private void payment_w_opb_Load(object sender, EventArgs e)
        {
            ReportDocument cryRpt = new ReportDocument();
            cryRpt.Load(@"D:\Completing\WindowsFormsApplication1\CrystalReport23.rpt");
            crystalReportViewer1.ReportSource = cryRpt;
            crystalReportViewer1.Refresh();
        }

        private void CrystalReport241_InitReport(object sender, EventArgs e)
        {
        }
    }
}
Posted
Updated 26-Aug-14 17:51pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900