ReportViewer control throws Invalid Cast error when being dragged to form in Visual Studio 2019

Mikhail Govender 1 Reputation point
2021-08-17T04:32:42.507+00:00

Hi,

I am currently working on a WinForm project in VS2019 that involves adding a report.

I have created a report using SSRS and need to embed it into my main application, however, I have been unable to add a report viewer control to my form without any issues and it is beginning to become frustrating as no online solution has helped.

The current error:
123754-screenshot-2021-08-17-062757.png

What I have tried:

  • Installed all reporting extensions needed
  • Installed multiple reporting nuget extensions
    123657-ss.png

And still I have been unsuccessful in using the reportViewer.

Any help with installing and running the reportViewer successfully on VS2019 would be great

SQL Server Reporting Services
SQL Server Reporting Services
A SQL Server technology that supports the creation, management, and delivery of both traditional, paper-oriented reports and interactive, web-based reports.
2,878 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Joyzhao-MSFT 15,571 Reputation points
    2021-08-17T06:48:12.15+00:00

    Hi @Mikhail Govender
    Do you mean that the report viewer control could not be found in the toolbox? To add it to toolbox, you can click on Choose Items and then Browse your solution directory and from the NuGet package folders go to report viewer package folder and select Microsoft.ReportViewer.WinForms.dll.
    You could refer to the document: Integrate Reporting Services Using the Report Viewer Controls-Get Started.
    I think it’s easier to understand through the video:
    How to Download and Install Report Viewer for Visual Studio 2019.
    Report Viewer not Working in Visual Studio 2019 - How to add RDLC Report viewer in c#.
    Best Regards,
    Joy


    If the answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments