views:

1304

answers:

9

How to remove or hide the main tab section in Crystal Report Viewer (C#).

A: 
Go into ControlPanel
select Add or Remove Programs
scroll down to Crystal Reports
Click on Remove button.
dar7yl
ooo - someone doesn't have a sense of humor
dar7yl
Oh, I'm sure they do. They just don't like seeing useless answers.
David Brown
A: 
            foreach (Control control in crystalReportViewer1.Controls)
            {

                if (control is CrystalDecisions.Windows.Forms.PageView)
                {

                    TabControl tab = (TabControl)(CrystalDecisions.Windows.Forms.PageView)control).Controls[0];

                    tab.ItemSize = new Size(0, 1);

                    tab.SizeMode = TabSizeMode.Fixed;

                    tab.Appearance = TabAppearance.Buttons;

                }

            }
omid
A: 

crystalReportViewer1.DisplayStatusBar = false;

rafalba
A: 

sorry, now I saw that you ask for "tap section" within the meaning of "main report". how will I know how to remove it will tell you. Rafal

rafalba
A: 

thanks for -1 heh:) I wanted to help

rafalba
A: 

Omid's answer is correct, but you have to make sure to do that stuff after you have set the viewer's ReportSource. The version in my function below is a little more robust, and makes what's going on a little clearer, though I'm still not sure why doing that bit of magic to the TabControl's ItemSize and SizeMode make the tab bar go away.

// This is a method of a Form with one of these:
//     CrystalDecisions.Windows.Forms.CrystalReportViewer
// This hides the tab control with the "Main Report" button.
public void hideTheTabControl()
{
    System.Diagnostics.Debug.Assert(
        crystalReportViewer1.ReportSource != null, 
        "you have to set the ReportSource first");

    foreach (Control c1 in crystalReportViewer1.Controls)
    {
        if (c1 is CrystalDecisions.Windows.Forms.PageView)
        {
            PageView pv = (PageView)c1;
            foreach (Control c2 in pv.Controls)
            {
                if (c2 is TabControl)
                {
                    TabControl tc = (TabControl)c2;
                    tc.ItemSize = new Size(0, 1);
                    tc.SizeMode = TabSizeMode.Fixed;
                }
            }
        }
    }
}
Jeff Roe
A: 

how can i do this in VB .net the code in C #

thermo_ll
A: 

Thanks.

In VB it should seem like this:

    For Each c1 As Control In CrystalReportViewer1.Controls
        If c1.GetType Is GetType(CrystalDecisions.Windows.Forms.PageView) Then
            Dim pv As CrystalDecisions.Windows.Forms.PageView = c1
            For Each c2 As Control In pv.Controls
                If c2.GetType Is GetType(TabControl) Then
                    Dim tc As TabControl = c2
                    tc.ItemSize = New Size(0, 1)
                    tc.SizeMode = TabSizeMode.Fixed
                End If
            Next
        End If
    Next
kadghar
A: 

Hi , How do we do this in a Web form in Visual Studio 2010? The TabControl is not available. Thanks in advance. - Sushmita

Sushmita