CS1503 Аргумент 1: не удается преобразовать из - C#
Формулировка задачи:
Доброго времени. Достались мне исходники программы для Винды. И я столкнулась с такой ошибкой.
C# CS1503 Аргумент 1: не удается преобразовать из "Trading.ReportForm.ReportDataSource" в "Microsoft.Reporting.WinForms.ReportDataSource".
Вот код
Я плохо разбираюсь в c# помогите понять почему конфликтует
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Windows.Forms;
namespace Trading
{
public partial class ReportForm : Form
{
public ReportForm(List<Trade> trades)
{
InitializeComponent();
trades = trades.OrderBy(item => item.Date).ToList();
TradeBindingSource.DataSource = trades;
ReportDataSource ds1 = new ReportDataSource
{
Name = "DataSet1",
Value = TradeBindingSource
};
reportViewer1.LocalReport.ReportEmbeddedResource = "Trading.TradeReport.rdlc";
reportViewer1.LocalReport.DataSources.Add(ds1); //останавливается на этом и месте и говорит, что не может преобразовать
}
private void ReportForm_Load(object sender, EventArgs e)
{
this.reportViewer1.RefreshReport();
}
private class ReportDataSource
{
internal string Name;
internal BindingSource Value;
}
}
}Решение задачи: «CS1503 Аргумент 1: не удается преобразовать из»
textual
Листинг программы
///.....
TradeBindingSource.DataSource = trades;
reportViewer1.LocalReport.DataSources.Clear();
Microsoft.Reporting.WinForms.ReportDataSource reportDataSource = new Microsoft.Reporting.WinForms.ReportDataSource("DataSet1", TradeBindingSource);
this.reportViewer.LocalReport.DataSources.Add(reportDataSource );