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

  • Home
  • SEARCH
  • 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 8063205
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T10:56:52+00:00 2026-06-05T10:56:52+00:00

Ok so my scenario is that I have a single report viewer on a

  • 0

Ok so my scenario is that I have a single report viewer on a form, that connects multiple reports based on a choice. I have all of my reports set as an Embedded Resource for the build action.

I am loading the reports like this before I set my parameters.

myReportViewer.LocalReport.ReportEmbeddedResource = "MyApp.MyReport1.rdlc";

OR

myReportViewer.LocalReport.ReportEmbeddedResource = "MyApp.MyReport2.rdlc";

This situation is very odd. Let’s say I run the app and I choose MyReport1 first and run it. This report is the one that holds the parameters. MyReport2 doesn’t have any parameters, just data sources. MyReport1 will load correctly and everything runs perfectly. I can then switch to MyReport2 and go back and forth between both reports as many times as I want.

Let’s say I run MyReport2 first. It loads correctly and I can run it multiple times. However, if I switch back to MyReport1 it throws the following exception when I try to set the parameters.

An attempt was made to set a report parameter 'TotalTime' that is not defined in this report.

Looking at this exception I would be assuming that MyReport1 didn’t load for some reason. When I set the LocalReport.ReportEmbeddedResource. What would cause the MyReport1 not to load correctly just because I hadn’t used it first?

Here is the code, I have of course trimmed out pieces that I can’t show.

if (ReportComboBox.SelectedItem.ToString() == "Time by user") {
     myReportViewer.LocalReport.DataSources.Clear();
     ReportDataSource datasource = new ReportDataSource();
     datasource.Name = "DataSet1";
     datasource.Value = DataSet1BindingSource;
     myReportViewer.LocalReport.DataSources.Add(datasource);
     try {
          myReportViewer.LocalReport.ReportEmbeddedResource = "";
          myReportViewer.LocalReport.ReportEmbeddedResource = "MyApp.MyReport1.rdlc";
          ReportParameter test = new ReportParameter("TotalTime", total.ToString("c"));
          myReportViewer.LocalReport.SetParameters(test);
          myReportViewer.RefreshReport();
     } catch (Exception ex) { 

     }
} else if (ReportComboBox.SelectedItem.ToString() == "Time - Everyone") {
     myReportViewer.LocalReport.DataSources.Clear();
     ReportDataSource datasource = new ReportDataSource();
     datasource.Name = "CompetitionUsers";
     datasource.Value = MyData;
     myReportViewer.LocalReport.DataSources.Add(datasource);
     myReportViewer.LocalReport.ReportEmbeddedResource = "";
     myReportViewer.LocalReport.ReportEmbeddedResource = "MyApp.MyReport2.rdlc";
     myReportViewer.RefreshReport();
}

Time by user, is the section that is freaking out. By looking at the code there is nothing really helpful there. It works as long as I run it first.

  • 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-06-05T10:56:54+00:00Added an answer on June 5, 2026 at 10:56 am

    What you need to do is call myReportViewer.Reset() before loading a new report. Doing so will reset the ReportViewer control to its default state and the LocalReport object will be replaced with a new instance. This should solve your problem.

    (Actually, I’ve just stumbled upon a very similar post that had the same solution :: LocalReport.SetParameters Exception An attempt was made to set a report parameter 'ParameterName' that is not defined in this report)

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

Sidebar

Related Questions

scenario: I have difficulty in building a single query that would display a report
I have a scenario that we should have a single choice mode radio button
So here's my scenario: I have a Cisco login and logout report that exports
Scenario I have a single base class and 2 (possibly 3) other classes that
I have a single form that, depending on which radio button is clicked (Login
I have an single threaded, embedded application that allocates and deallocates lots and lots
Lets assume a scenario that i have a remote, a developer1 and a developer2.
My scenario is that I have some payment transaction data in MySQL and some
I have a path defined: when /the admin home\s?page/ /admin/ I have scenario that
I have a scenario that looks like this: #include <algorithm> using namespace std; //

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.