Symptom
- The Crystal Reports viewer, below the toolbar there is a static box with "Main Report" in it
- As this takes up space, there is the need to remove this text box
Resolution
- VB Code
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# Code
private void HideReportTab(CrystalDecisions.Windows.Forms.CrystalReportViewer crViewer)
{
TabControl tabs;
foreach(Control control in crViewer.Controls)
{
if(control is CrystalDecisions.Windows.Forms.PageView)
{
foreach (Control controlInPage in control.Controls)
{
if (controlInPage is System.Windows.Forms.TabControl)
{
tabs = (TabControl) controlInPage;
tabs.ItemSize = new Size(0, 1);
tabs.SizeMode = TabSizeMode.Fixed;
}
}
}
}
}
Keywords
KBA , BI-DEV-NET-SDK , .NET SDK / COM SDK , How To
Product
Crystal Reports 2008 V1 ; SAP Crystal Reports XI R2