I've created a crystal report then after creating it, I've created a winform where I've import crystal report library (shown in code) and used a report viewer to view the report but i not able to view the report, the code, i am new with Crytal Reports, the code I've done is :
Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using CrystalDecisions.CrystalReports.Engine;
namespace InventorySoftware
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
this.reportViewer1.RefreshReport();
}
private void button1_Click(object sender, EventArgs e)
{
//string ReportSources = "";
ReportDocument cryRpt = new ReportDocument();
cryRpt.Load("C:\\Users\\Ahsan\\Desktop\\PROJECT INVENTORY SOFTWARE\\InventorySoftware\\InventorySoftware\\CrystalReport1.rpt");
reportViewer1.ReportSource = cryRpt;
reportViewer1.Refresh();
}
}
}
it's giving error at reportViewer1.ReportSource = cryRpt;
and the error is
Error 1 'Microsoft.Reporting.WinForms.ReportViewer' does not contain a definition for 'ReportSource' and no extension method 'ReportSource' accepting a first argument of type 'Microsoft.Reporting.WinForms.ReportViewer' could be found (are you missing a using directive or an assembly reference?) C:\Users\Ahsan\Desktop\PROJECT INVENTORY SOFTWARE\InventorySoftware\InventorySoftware\Form1.cs 34 27 InventorySoftware