Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 821557
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T02:39:36+00:00 2026-05-15T02:39:36+00:00

I have a class which uses a list for passing to ssrs and for

  • 0

I have a class which uses a list for passing to ssrs
and for each report I had to define a list of that type.
like this

List<ReportClass1> ReportClass1prods;
public List<ReportClass1> GetReportClass1
{
    get
    {
        return ReportClass1prods;
    }
}
List<ReportClass2> ReportClass2prods;
public List<ReportClass2> GetReportClass2
{
    get
    {
        return ReportClass2prods;
    }
}

List<ReportClass3> ReportClass3prods;
public List<ReportClass3> GetReportClass3
{
    get
    {
        return ReportClass3prods;
    }
}

and then each one has its own function

public void LoadReport1(List<ReportClass1> products)
{
    ReportClass1prods = products;
    reportViewer1.Clear();
    reportViewer1.Reset(); 
    reportViewer1.ProcessingMode = ProcessingMode.Local;
    reportViewer1.LocalReport.ReportPath = "Report1.rdlc";
    reportViewer1.LocalReport.DataSources.Add(
            new ReportDataSource("ReportClass1", GetReportClass1));
    reportViewer1.RefreshReport();
}

Is there anyway/ what is the best way to make it so I dont need to copy and paste each list function for each new report but can dynamically figure out the type so there is only 1 list and 1 load function?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T02:39:37+00:00Added an answer on May 15, 2026 at 2:39 am

    Check which common class or interface are ReportClass1,2,3 derived from (or if these are your classes, not some kind of generated ones, make it derive from a common base class or interface). Then use List<BaseClass>, e.g. List<ReportClass>.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application App1 which defines class A and uses instances of this
I have some logic, which defines and uses some user-defined types, like these: class
I have a class which is marked with a custom attribute, like this: public
I have a class which looks something like this: public class Test { private
I have the following class which uses BinaryReader internally and implements IDisposable. class DisposableClass
I have a container class which uses boost::optional to hold the value. Here is
I have a main page which uses a ViewModel I have created: public class
I have developed a Java Swing application, which uses the SwingWorker class to perform
I am trying to compile kmeans.java which uses a FloatArrayWritable class . I have
I have a class that uses an add-on template to add additional functionality as

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.