none
Error when adding more that one Class as a DataSet to VB 2010 ReportViewer RRS feed

  • Question

  • Hello,

    When I try to add more than one Class as a DataSet using the same methodology that i did for the first one, I get a lot of errors. So, I am doing something wrong.

    I added another Class and  Named it SDCinfo and then entered the code for the added Class so that it would show up in the Application Data Sources. I also added a BindingSource to the ReportViewer form (SCoPeReport.vb) and selected SDCinfo as the Application Data Source for it. I then added code behind the ReportViewer form for the new ReportDataSource named "SDCat". The first one was named "Proj". I then dragged and dropped the data from the Report Data to the Report1.rdlc and tried to run it in debug.

    I got 34 errors all of which are similar to this:

    Error    43         The Value expression for the text box ‘Textbox5’ refers to the field ‘ClcNo’. Report item expressions can only refer to fields within the current dataset scope or, if inside an aggregate, the specified dataset scope.    C:\Documents and Settings\DCD\My Documents\Visual Studio 2010\Project Report Viewer TEST\IBC 2009 BRACE\IBC 2009\Report1.rdlc           SCoPe 2009

    The code the I have behind the ReportViewer form and for the second Class that I added for the second Class is shown below.

    I am going to need 10 or 12 of the Classes to be used as DataSets. Can you tell me where I am making my mistake?

    Thank you,

    Dan

    Imports System.Collections.Generic

    PublicClass SDCatInfo :Inherits List(OfSDCinfo) 'From this above line Data Sourced gets Drag]Drop witgh fields below.

    EndClass

    PublicClass SDCinfo

       Private _OCat AsString

       Private _SClass AsString

       Private _Ss AsDouble

       Private _S1 AsDouble

       Private _Fa AsDouble

       Private _Fv AsDouble

       Private _SMS AsDouble

       Private _SM1 AsDouble

       Private _SDS AsDouble

       Private _SD1 AsDouble

       Private _ShtCat AsString

       Private _LngCat AsString

       Private _AppCat As String

       Public SharedFunction GetListOfSDCinfo()

           Dim MySDCinfoList As New List(OfSDCinfo)

           Dim theSDCinfo AsNew SDCinfo

           theSDCinfo._OCat = gsUseGroup

           theSDCinfo._SClass = gsSclass

           theSDCinfo._Ss = gdSs

           theSDCinfo._S1 = gdS1

           theSDCinfo._Fa = (Format(gdFa, " 0.00"))

           theSDCinfo._Fv = (Format(gdFv, " 0.00"))

           theSDCinfo._SMS = (Format(gdSms, " 0.000"))

           theSDCinfo._SM1 = (Format(gdSm1, " 0.000"))

           theSDCinfo._SDS = (Format(gdSds, " 0.000"))

           theSDCinfo._SD1 = (Format(gdSd1, " 0.000"))

           theSDCinfo._ShtCat = SHTgrp

           theSDCinfo._LngCat = LONGgrp

           theSDCinfo._AppCat = gsSDcat

           MySDCinfoList.Add(theSDCinfo)

           GetListOfSDCinfo = MySDCinfoList

       End Function

       Public Property OCatAs String

           Get

               Return _OCat

           End Get

           Set(value AsString)

               _OCat = value

           End Set

       End Property

       Public Property SClassAs String

           Get

               Return _SClass

           End Get

           Set(value AsString)

               _SClass = value

           End Set

       End Property

       Public Property SsAs String

           Get

               Return _Ss

           End Get

           Set(value AsString)

               _Ss = value

           End Set

       End Property

       Public Property S1As String

           Get

               Return _S1

           End Get

           Set(value AsString)

               _S1 = value

           End Set

       End Property

       Public Property FaAs String

           Get

               Return _Fa

           End Get

           Set(value AsString)

               _Fa = value

           End Set

       End Property

       Public Property FvAs String

           Get

               Return _Fv

           End Get

           Set(value AsString)

               _Fv = value

           End Set

       End Property

       Public Property SMSAs String

           Get

               Return _SMS

           End Get

           Set(value AsString)

               _SMS = value

           End Set

       End Property

       Public Property SM1As String

           Get

               Return _SM1

           End Get

           Set(value AsString)

               _SM1 = value

           End Set

       End Property

       Public Property SDSAs String

           Get

               Return _SDS

           End Get

           Set(value AsString)

               _SDS = value

           End Set

       End Property

       Public Property SD1As String

           Get

               Return _SD1

           End Get

           Set(value AsString)

               _SD1 = value

           End Set

       End Property

       Public Property ShtCatAs String

           Get

               Return _ShtCat

           End Get

           Set(value AsString)

               _ShtCat = value

           End Set

       End Property

       Public Property LngCatAs String

           Get

               Return _LngCat

           End Get

           Set(value AsString)

               _LngCat = value

           End Set

       End Property

       Public Property AppCatAs String

           Get

               Return _AppCat

           End Get

           Set(value AsString)

               _AppCat = value

           End Set

       End Property

    EndClass

         

       Private Sub SCoPeReport_Load(senderAs System.Object, eAs System.EventArgs)Handles MyBase.Load

           ReportViewer1.LocalReport.DataSources.Clear()

           Dim thePrjData AsNew Microsoft.Reporting.WinForms.ReportDataSource("Proj",ProjInfo.GetListOfProjInfo())

           ReportViewer1.LocalReport.DataSources.Add(thePrjData)

           Dim theSDCData AsNew Microsoft.Reporting.WinForms.ReportDataSource("SDCat",SDCinfo.GetListOfSDCinfo())

           ReportViewer1.LocalReport.DataSources.Add(theSDCData)

           Me.ReportViewer1.SetDisplayMode(Microsoft.Reporting.WinForms.DisplayMode.PrintLayout)

           'Me.ReportViewer1.RefreshReport()

       End Sub

    EndClass


    Dan


    Dan

    Wednesday, March 6, 2013 4:50 PM