Displaying list data in a Microsoft Report Viewer control

Posted on 2009-12-18
Last Modified: 2013-11-26
I'm using Visual Studio 2008 with Visual Basic .Net web forms to display a local report.  I am not using SSRS.  I am not using Crystal Reports but rather the Microsoft Report Viewer.

I have a series of business data objects which source their data from an xml file.  I am attempting to use these objects to display this data in a report.

It seems to work fine if I want to display data at the top level of the hierarchy of data objects, it also works if I want to display an individual record from one of the child collections ie. =Fields!MyCollection.Value(2)

However, I can't figure out how to populate a graph/chart or table with list data based on the same collections...
ie: =Fields!MyCollection.Value

I have attempted to use basic arrays for the collections and also generic collection objects to no avail.

When attempting to populate a graph no data populates it.  When I attempt to populate a table it simply displays the text "#Error"

I have also attempted to use a datatable containing the required data but the report won't allow me to drag the data table property from my datasource onto the report for some reason.  I can't see how I could use a datatabe as my source object.

See code snipet for how I am setting up the report data.  A couple of things in this method might look strange:
1) I am destroying and replacing the dataview control on the form because the form.  The form is set up so the user can choose a report from a treeview from a left pane and it displays in the right pane.  There seems to be a bug in the report viewer where it will only display the first report selected.  This is my attempt at a work-around.

2) Even though my potentialproperty object is a singular object, I am loading it into a collection so that the object I am parsing implements iEnumerable.  Not sure if this is the best way of doing things but it seems to work.

Thanks in advance,

Private Sub LoadReport(ByVal strReportPath As String)

        Dim rpv As Microsoft.Reporting.WinForms.ReportViewer

        rpv = New Microsoft.Reporting.WinForms.ReportViewer()

        rpv.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Local

        rpv.LocalReport.ReportPath = strReportPath

        Dim col As Collection = New Collection


        rpv.LocalReport.DataSources.Add(New Microsoft.Reporting.WinForms.ReportDataSource("DataLayer_PotentialProperty", col))



        If Not rvReportViewer Is Nothing Then


            rvReportViewer = Nothing

        End If

        rvReportViewer = rpv


    End Sub

Open in new window

Question by:RedneckWonderland
    LVL 2

    Expert Comment


    Author Comment


    I already found that site.  It got me to the point I am at now but is no help with the problems I am currently experiencing

    Accepted Solution

    I've just figured out how to create a strongly written dataset which enables me to use a dataset to acheive what I want to achieve here.  It isn't ideal but it's a solution.

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Join & Write a Comment

    Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
    Introduction Earlier I wrote an article about the new lookup functions ( that ship with SQL Server 2008 R2.  In this article I’m going to show you another new feature of SSRS 2008 R2, this time in the vis…
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now