question

MikhailGovender-2031 avatar image
0 Votes"
MikhailGovender-2031 asked Joyzhao-MSFT commented

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

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
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @MikhailGovender-2031 ,
Has your issue been resolved?
If you have any questions, please feel free to let me know.
If the answer is helpful, please click "Accept Answer" and upvote it.
Best Regards,
Joy

0 Votes 0 ·

1 Answer

Joyzhao-MSFT avatar image
0 Votes"
Joyzhao-MSFT answered

Hi @MikhailGovender-2031
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.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.