Click here to Skip to main content
15,893,588 members
Please Sign up or sign in to vote.
4.00/5 (2 votes)
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;
using CrystalDecisions.Shared; 


namespace Reports
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void btnSimpleReport_Click(object sender, EventArgs e)
        {
            NorthwindDataSet dts = new NorthwindDataSet();
            NorthwindDataSetTableAdapters.CustomersTableAdapter dta = new NorthwindDataSetTableAdapters.CustomersTableAdapter();
            dta.Fill(dts.Customers);
            RPTsimple report = new RPTsimple(); //create instance
            report.SetDataSource(dts);
            crystalReportViewer1.ReportSource = report; //Problem Line
        }


Why is ReportSource underlines in visual studio. Im using C# framework 3.5
look at //problem line
my error:
'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?)
Posted
Updated 29-Aug-12 1:24am
v2
Comments
Dhinesh kumar.V 29-Aug-12 7:41am    
You will try to add some extra reference and use ReportDocument report =new ReportDocument() instead of your create instance line. Just try this one.

I think
C#
report.SetDataSource(dts);

this is the problem line.
C#
report.SetDataSource(dts.Tables[0]);


Try this.
 
Share this answer
 
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;

.....
...


crystalReportViewer1.ReportSource = report;
Why ... always => missing using direct ... reference..
problem with .ReportSource not definition...
?????
some body help me!
 
Share this answer
 
I had a same problem. When i drag and drop CrystalReportViewer1 on my aspx page(not code behind file) instead of ReportViewer control from Reporting section of toolbox, there was no error that the
'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?)

Muhammad asif assiff79@gmail.com
 
Share this answer
 
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