I want to fill a report page with attributes of an object and display it in a reportViewer. This object I selected before in the Report Wizard and a DataSet was generated.
Now I am trying to use this code to add the values to the report. I am putting that single object into a list because "ReportDataSource" doesn't accept objects. But when I run it, the report is blank and the values were not displayed. What am I doing wrong? I am new to reports and I hope someone can help me.
private void button2_Click(object sender, EventArgs e)
{
MyObject myobject = new MyObject();
myobject.Artikelnr = "12345";
myobject.Aussehen = 1;
myobject.Bemerkungen = "cool";
List<MyObject> objectlist = new List<MyObject>();
objectlist.Add(myobject);
ReportDataSource rds = new ReportDataSource("DataSet1", objectlist);
reportViewer1.LocalReport.DataSources.Add(rds);
reportViewer1.Refresh();
}
