RSS

Change “Main Report” tab in Crystal Report

20 Nov

You Can  Change the “Main Report”  tab/title to be removed in the ReportViewer.  Or you can the title be changed to it.

VB.Net 

You Can Call following function after form.show method(where form conatin crystalReportViewer Control). At the end of datasource like

//////////////////

Report.SetDataSource(ds1)
CrystalReportViewer1.ReportSource = Report
CrystalReportViewer1.Refresh()
FormatReportViewer()

/////////////////////////////////////////////Function/Method/Recommande////////////////

Private Sub FormatReportViewer()

Dim thisObj As Object

Dim MyPageView As CrystalDecisions.Windows.Forms.PageView

Dim tcontrol As Windows.Forms.TabControl

 

For Each thisObj In CrystalReportViewer1.Controls

 

Select Case UCase(thisObj.GetType.Name)

‘Case “STATUSBAR”

‘    CType(thisObj, StatusBar).Visible = False

Case “PAGEVIEW”

MyPageView = CType(thisObj, CrystalDecisions.Windows.Forms.PageView)

tcontrol = CType(MyPageView.Controls(0), TabControl)

With tcontrol

 

 

If .TabPages.Count > 0 Then

 

With .TabPages(0)

 

.Text = “Your Heading”

.Visible = True

End With

End If

End With

End Select

Next

 

End Sub

 

Other Way.

I know this is very old post, but I have found a way to hide the “Main Report” tab so I want to share it.  This seems to still be an issue in Win forms even with version 13.

 

foreach ( object control in _crystalReportViewer.Controls )

{

string name = control.GetType().Name;

if ( name == “PageView” )

{

CrystalDecisions.Windows.Forms.PageView pageView = control as CrystalDecisions.Windows.Forms.PageView;

if ( pageView != null && pageView.Controls.Count > 0 )

{

TabControl tabControl = pageView.Controls[0] as TabControl;

if ( tabControl != null && tabControl.TabPages.Count > 0 )

{

TabPage tabPage = tabControl.TabPages[0];

 

tabControl.Top = tabControl.Top – tabControl.ItemSize.Height;

tabControl.Height = tabControl.Height + tabControl.ItemSize.Height;

tabControl.Region = new Region( new RectangleF( tabPage.Left, tabPage.Top, tabPage.Width, tabPage.Height + tabControl.ItemSize.Height ) );

}

}

break;

}

}

 

 

I call this code from the load event handler.

 

Tab Print

Advertisements
 
Leave a comment

Posted by on November 20, 2013 in Crystal Report

 

Tags: , , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: