search63 (1) [Avatar] Offline
I added reportViewer to my project.I designed a report that i chosed an object class as a data source. And I added a table to my report design. And I added object variables to my table. But even if i changed one of object variable in my main program always there seem 0 in the table....
>>>>My object class consists set and get methods of some variables.
>>>> I want to show values of these variables in my reportViewer

What could be the problem?
eebrown (89) [Avatar] Offline
Re: reportviewer connection with Object.
I presume you mean the Windows Forms version of this control in .NET 2.0. Have you read through the .NET documentation and walkthroughs on this control. You can see this online at

I have not used an object-based data source with report viewer, but it should work. To use an object as a data source, you need to support the data collection interfaces to make sure that .NET can use this interactively. There is a discussion of the collection classes in chapter 5, and details on data binding in chapter 17. Of course, this is based on the .NET 1.x versions. In .NET 2.0 you'd probably want to use the generic collection classes, which makes this task a whole lot easier.

So I would make sure you work through the .NET walkthroughs mentioned in the above reference, and read through chapter 5 and 17 if you haven't done so already.

Finally, make sure you are assigning the right object as the data source. According to the documentation, the data source may be an instance of System.Data.DataTable, a System.Collections.IEnumerable value (for example, System.Data.DataView or System.Array), a System.Windows.Forms.BindingSource (for the Microsoft Windows Form control), or a System.Web.UI.IDataSource (for the ASP.NET server control).

Typically, you'll have better luck if you create the simplist of examples, for instance using a System.Array of string objects as the source for your report. Once you make an array of strings work, expand the sample to add the complexity you really wish to provide.

Hope that helps,