Results 1 to 10 of 10

Thread: [RESOLVED] rdlc Report not displaying correctly - top part missing

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2010
    Posts
    350

    Resolved [RESOLVED] rdlc Report not displaying correctly - top part missing

    Sorry for displaying such large images but I wanted to show the problem - I've tried before to describe it in words and got no response.

    When I run my report the first time it displays correctly - see below.
    Name:  1st.jpg
Views: 6619
Size:  300.3 KB

    If I run the report a second time, sometimes it does not display all the report - the top part is missing - see below (here I have run it on a different person).
    Name:  2nd.jpg
Views: 6308
Size:  292.5 KB

    I have found the only solution is to exit the option completely and run the report again - you can see the report is now correct - see below
    Name:  3rd.jpg
Views: 6279
Size:  293.9 KB

    There must be some initialisiation missing.

    I do have
    Code:
    ReportViewer1.Reset()
    On the report form load.

    Can you suggest what I am doing wrong or suggest where I can look for more help.
    Thanks

  2. #2
    PowerPoster
    Join Date
    Sep 2005
    Location
    Modesto, Ca.
    Posts
    5,195

    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.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2010
    Posts
    350

    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

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2010
    Posts
    350

    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.

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2010
    Posts
    350

    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.

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2010
    Posts
    350

    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

  7. #7
    PowerPoster
    Join Date
    Sep 2005
    Location
    Modesto, Ca.
    Posts
    5,195

    Re: rdlc Report not displaying correctly - top part missing

    Do you close "frmReport" before you run the second report?

  8. #8

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2010
    Posts
    350

    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.

  9. #9

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2010
    Posts
    350

    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

  10. #10
    PowerPoster
    Join Date
    Sep 2005
    Location
    Modesto, Ca.
    Posts
    5,195

    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
  •  



Click Here to Expand Forum to Full Width