Winforms ReportViewer Not Displaying

I am using Visual Studio Express 2012, I am trying to invoke my deployed reports using winforms, this is what I did.

  • I created a new winforms c # application
  • I went to the toolbar to find the ReportViewer control (but it wasn’t there)
    2.1 So, I added it manually by clicking clicking Toolbox > Choose Items > then i selected the report viewer
  • After that, I dragged it into the form (but it goes straight to the lower tray and does not give me any options)

enter image description here

I have seen many questions that touch on the same problem, but without a solution.

0
source share
2 answers

The problem was Microsoft.ReportViewer.WinForms version 10, I'm not sure why, but it did the same thing on my colleague's computer.

Here is what I did:

  • Download and install Microsoft.ReportViewer.WinForms version 11.0.0.0
  • I went to the toolbar and right clicked > Choose Items
  • From there, I selected Microsoft.ReportViewer.WinForms version 10 and the selected version 11.
  • Then I returned to my decision to drag the report viewer into my form, it worked
0
source

I tried the accepted answer, but that did not help me.

So another solution could be:

In your Designer.cs file you need to add this line (manually):

 this.Controls.Add(this.reportViewer1); 

This is my example in a form called "FrmPreviewRpt1":

 // // FrmPreviewRpt1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(725, 305); this.Controls.Add(this.reportViewer1); // This is the new line. this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.Name = "FrmPreviewRpt1"; this.Text = "FrmPreviewRpt1"; this.ResumeLayout(false); 

Here is a screenshot of the result:

sample result

The bad news with this approach is that you must manually resize (and possibly other visible attributes) in the Designer.cs file.

0
source

Source: https://habr.com/ru/post/1212043/


All Articles