1434517 - How to remove the "Main Report" tab on the Crystal Reports viewer for VS .NET

SAP Knowledge Base Article - Public

1434517 - How to remove the "Main Report" tab on the Crystal Reports viewer for VS .NET

Symptom

  • The "Main Report" tab takes up space on the viewer.
  • Sometimes it may be advantageous to remove this tab.

Resolution

The code below will remove the "Main Report" tab from the viewer.

Private Sub HideReportTab(ByVal crViewer As CrystalDecisions.Windows.Forms.CrystalReportViewer)
        Dim control As Control
        Dim controlInPage As Control
        Dim tabs As TabControl
 
        For Each control In crViewer.Controls
            If TypeOf control Is CrystalDecisions.Windows.Forms.PageView Then
                For Each controlInPage In control.Controls
                    If TypeOf controlInPage Is TabControl Then
                        tabs = CType(controlInPage, TabControl)
                        tabs.ItemSize = New Size(0, 1)
                        tabs.SizeMode = TabSizeMode.Fixed
                    End If
                Next
            End If
        Next
 End Sub

C#
There is a better way to control tabs in CR for VS now:

You can control the Focus default:

// if no groups in report hide the group tree in viewer

if (rptClientDoc.DataDefController.DataDefinition.Groups.Count == 0)

{
    crystalReportViewer1.SetFocusOn(UIComponent.Page);

   
crystalReportViewer1.ToolPanelView = ToolPanelViewType.None;

}
else

{
    crystalReportViewer1.ToolPanelView = ToolPanelViewType.GroupTree;

    crystalReportViewer1.SetFocusOn(UIComponent.GroupTree);

}

Keywords

forum thread , KBA , BI-DEV-NET , BI Software Development Kits (SDKs) - .NET or Other , How To

Product

Crystal Reports 2008 V0 ; Crystal Reports 2008 V1 ; SAP Crystal Reports 2011 ; SAP Crystal Reports XI R2 ; SAP Crystal Reports, developer version for Microsoft Visual Studio