none
Print Layout as default RRS feed

  • Question

  • Hi.
    I am using the Report Viewer component (VS2005/VS2008, C#).  Most things work quite well.  I would like to display my reports in Print Layout as default without having my user to click the Print Layout button on the ReportViewer toolbar.  How do I accomplish this?  Searching the ReportViewer class´s member list, I do not find anything suitable.

    Regards,
    Gudni
    G.Sig
    Tuesday, July 1, 2008 8:19 AM

Answers

  •  Add this event handler:

    Private Sub frmBaseReportVisualStudio_Shown(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Shown

    If System.Threading.Thread.CurrentThread.ThreadState = Threading.ThreadState.Running Then

    If Me.ReportViewer1.Visible = True Then

    Me.ReportViewer1.SetDisplayMode(Microsoft.Reporting.WinForms.DisplayMode.PrintLayout)

    End If

    End If

    End Sub

    External IF is needed only to avoid problem at design time because in my solution this code is inherited and there is an inheritance bug in visual studio.

    C.

    Tuesday, July 1, 2008 1:42 PM