reportViewer is not linking

Pat C 1 Reputation point
2023-02-07T21:30:44.4233333+00:00

Hello,

I am using the Community version of VS2022 and have creates a couple of rdlc reports. When i try and drag the ReportViewer into my form the only thing I can see is an item in the area under my from that says: reportViewer1. I can't seem to find a way to connect it to my rdlc reports. My database is an MS ACCESS.

I have the following NuGet packages installed:

Microsoft.ReportViewer.WinForms.v12

Corrected.Microsoft.ReportingServices.ReportViewerControl.Winforms

Microsoft.ReportingServices.ReportViewerControl.Winforms

Bing as much as I want I cannot find what I am doing wrong. Any help is certainly appreciated.

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
4,627 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,278 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Michael Taylor 48,581 Reputation points
    2023-02-07T22:19:22.0066667+00:00

    VS 2022 uses a new designer so many older controls don't work with it. In your case what you're seeing is that the designer doesn't recognize the older control is displayable so it puts it at the bottom as a component. You can still right-click and access the properties of the control as you would normally but it doesn't render on the form.

    This is a known issue. Part of the issue could be your reliance on the Corrected Nuget package which is not from MS. If you don't need this package then remove it. Additionally if you are building a .NET 6+ app or if you are building .NET Framework 4.x app with a packages.config file then you may run into issues. The Toolbox may not properly add the correct component.

    One recommendation to work around this, and it only works for .NET Framework with packages.config is to Choose Items in the Toolbox, browser to where the Nuget package is (it'll be under the packages folder of your solution) and then add it to the Toolbox again. This seems to solve the issue for some people.

    Alternatively, or if that doesn't work then drag and drop a panel onto your form where you want the report to go. This will give you the location and size information you need. You can then edit the properties of the report control (from the component drawer) to render in that location at runtime. It isn't ideal but it works.

    As for hooking up your RDLC to the report viewer you need to set the LocalReport property. Since you are building a local report you generally do the actual assignment at runtime but you could also set the nested properties (specifically the report path) in the designer if you wanted to.