-
Apr 23rd, 2013, 05:14 AM
#1
Thread Starter
Hyperactive Member
[RESOLVED] rdlc Report not displaying correctly - top part missing
-
Apr 23rd, 2013, 11:05 AM
#2
Re: rdlc Report not displaying correctly - top part missing
Sorry, don't have an answer, but you should post the code that displays the report and explain where the code is located.
-
Apr 24th, 2013, 02:25 AM
#3
Thread Starter
Hyperactive Member
Re: rdlc Report not displaying correctly - top part missing
Here is a cut down version of the code.
There are two global variables:
'MyReport' which is the name of the rdlc file,
and 'query' which is the SELECT statement used.
When you run it it is OK the first few times then the top of the report is missing.
Code:
Option Strict Off
Option Explicit On
Imports System.Windows.Forms
Imports System.Data.SqlClient
Public Class frmReport
Private Sub frmReport_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
Dim AppPath As String
AppPath = Environment.CurrentDirectory()
ReportViewer1.Reset() ' this is important
ReportViewer1.LocalReport.DisplayName = MyReport
ReportViewer1.LocalReport.ReportEmbeddedResource = "MIS." & MyReport & ".rdlc"
ReportViewer1.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Local
ReportViewer1.LocalReport.ReportPath = AppPath & "\" & MyReport & ".rdlc"
ReportViewer1.LocalReport.SetParameters(New Microsoft.Reporting.WinForms.ReportParameter("MyParam1", MyParameters(0)))
Me.Size = New Size(1030, 600) ' A4 landscape
ReportQuery = query
' create a data adaptor
Dim da As SqlDataAdapter = New SqlDataAdapter(ReportQuery, SQLConnection)
' create a new data set
Dim ds As DataSet = New DataSet
' fill the data adapter
da.Fill(ds)
' clear the datasource
ReportViewer1.LocalReport.DataSources.Clear()
' set the dataource (DataSet1 is defined in the matrix in the rdlc file)
Dim rds1 As New Microsoft.Reporting.WinForms.ReportDataSource("DataSet1", ds.Tables(0))
' add a new datasource
ReportViewer1.LocalReport.DataSources.Add(rds1)
ReportViewer1.RefreshReport()
End Sub
End Class
-
Apr 24th, 2013, 06:45 AM
#4
Thread Starter
Hyperactive Member
Re: rdlc Report not displaying correctly - top part missing
I have done some more work and can now reproduce the problem.
If you display a report and scroll down on the report.
When you display the next report the top is missing and it is impossible to scroll up to it.
If you print the report it is all there but it is not displayed in the report viewer.
A colleague has had a look at it and he thinks it is caused by AutoSizing - I have autosizing set to false on bothe the form and the report.
If you set Autosize to true it does not autosize.
This is why I programatically set the size for portrait and landscape reports.
-
Apr 24th, 2013, 10:41 AM
#5
Thread Starter
Hyperactive Member
Re: rdlc Report not displaying correctly - top part missing
It is nothing to do with autosizing.
It also occurs when I scroll to the right - when I run the report again I cannot access what was to the left.
The problem may be to do with resetting the scroll position.
-
Apr 25th, 2013, 10:16 AM
#6
Thread Starter
Hyperactive Member
Re: rdlc Report not displaying correctly - top part missing
I have tried setting the AutoscrollPosition and the AutoScrollOffset to zero but that has no effect
Code:
ReportViewer1.AutoScrollPosition = New Point(0, 0)
ReportViewer1.AutoScrollOffset = New Point(0, 0)
I tried to trap the scroll events but this code is not accessed when the user scolls the report.
Code:
Private Sub ReportViewer1_Scroll(sender As Object, e As System.Windows.Forms.ScrollEventArgs) Handles ReportViewer1.Scroll
End Sub
-
Apr 25th, 2013, 11:21 AM
#7
Re: rdlc Report not displaying correctly - top part missing
Do you close "frmReport" before you run the second report?
-
Apr 26th, 2013, 02:09 AM
#8
Thread Starter
Hyperactive Member
Re: rdlc Report not displaying correctly - top part missing
Yes, I close it using the 'x' button on the top right of the form.
There is no extra code to close it.
When I run the report again I load the form again.
-
May 28th, 2013, 09:37 AM
#9
Thread Starter
Hyperactive Member
Re: rdlc Report not displaying correctly - top part missing
I have at last managed to fix this, I added ReportViewer1.RefreshReport to the FormClose event.
Private Sub frmReport_FormClosing(sender As Object, e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
Me.ReportViewer1.RefreshReport()
End Sub
-
May 28th, 2013, 11:33 AM
#10
Re: [RESOLVED] rdlc Report not displaying correctly - top part missing
Glad you got it solved, doesn't seem that should be necessary but at least it works. I also noticed you use a Me.ReportViewer1.RefreshReport() in the form load event. Have you tried just showing the report instead of refreshing.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|