Click here to Skip to main content
13,258,269 members (39,877 online)
Rate this:
 
Please Sign up or sign in to vote.
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 29-Aug-12 2:06am
Updated 29-Aug-12 2: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.
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

I think
report.SetDataSource(dts);

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


Try this.
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

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!
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 3

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
  Permalink  
v2

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy |
Web02 | 2.8.171114.1 | Last Updated 16 Jun 2014
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100