Click here to Skip to main content
13,045,790 members (48,082 online)
Click here to Skip to main content
Add your own
alternative version


37 bookmarked
Posted 27 Apr 2003

Hiding the Crystal Report Viewer's Statusbar

, 27 Apr 2003
Rate this:
Please Sign up or sign in to vote.
Code to hide the Crystal Report Viewer's statusbar.



In .NET, the CyrstalReportViewer control is a very powerful tool. It’s supplied with most of the basics that people would require from it, except for one, straight off the bat. How do I hide the StatusBar? What makes it even more baffling is that you can hide both the group tree and the toolbar using the DisplayGroupTree and DisplayToolbar properties respectively. However, a DisplayStatusbar property is nowhere to be seen.

Dead ends

Under help for the CrystalReportViewer, there is supposed to be ViewerStatusBar property, which gets the StatusBar object. But this doesn't appear to be exposed in either VB.NET or C#. However, if you could get a hold of the StatusBar object, then you could set the StatusBar’s Visible property to False, causing it to be hidden.

So, how do I get hold of the StatusBar then?

More Background

In a nutshell, the CrystalReportViewer control is actually five controls combined. Namely:

  1. CrystalDecisions.Windows.Forms.PageView. The main window.
  2. System.Windows.Forms.Splitter. A splitter between the main window and the Group Tree.
  3. CrystalDecisions.Windows.Forms.ReportGroupTree. A tree view to allow you to drill down on the side of the report.
  4. System.Windows.Forms.ToolBar. The tool bar at the top that allows you to do things like export the report, print, etc.
  5. System.Windows.Forms.StatusBar. And our status bar that we would like to hide.

The Answer

So knowing that there are actually five controls within the CrystalReportViewer, all we need to do is search through all these controls. Find the StatusBar, and then set its Visible property to False. It’s that simple!

The Code

To set it up as a property for a UserControl (see the source project above), the code would look like this:

Public Property DisplayStatusBar() As Boolean
            Dim obj As Object
            Dim tempStatusbar As New StatusBar()

            For Each obj In Me.CrystalReportViewer1.Controls
                If obj.GetType Is tempStatusbar.GetType Then
                    Return CType(obj, StatusBar).Visible
                    Exit For
                End If

            tempStatusbar = Nothing
        End Get
        Set(ByVal Value As Boolean)
            Dim obj As Object
            Dim tempStatusbar As New StatusBar()

            For Each obj In Me.CrystalReportViewer1.Controls
                If obj.GetType Is tempStatusbar.GetType Then
                    CType(obj, StatusBar).Visible = Value
                    Exit For
                End If

            tempStatusbar = Nothing
        End Set
    End Property

The above code is less than ideal because the only way I could check the type of the control is to create an instance of the StatusBar, and then compare it with what the GetType method returns. Ideally, the code should look something like this:

Set(ByVal Value As Boolean)
    Dim obj As Object
    For Each obj In Me.CrystalReportViewer1.Controls
        If obj.GetType Is System.Windows.Forms.StatusBar Then
            CType(obj, StatusBar).Visible = Value
            Exit For
        End If
End Set

The reason why I couldn’t do it this way is that the obj.GetType Is System.Windows.Forms.StatusBar seems to be incompatible (System.Type vs. System.Windows.Forms.Type).

Anyway, if someone can get it to work without creating an extra instance of StatusBar, I’d love to hear from them.


I would like to repeat that this implementation is less than ideal. Then again, it’s less than ideal that we have to do this in the first place. Hopefully, this article obsoletes by the next version of .NET or even Crystal 9, where they may give you the property by default (here’s hoping). But to put all that aside for a moment, it’s a good workaround for hiding the StatusBar when displaying crystal reports in .NET!

I hope this helps someone out there!


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Andrew Fleming
Web Developer
Australia Australia
Who cares what my history is! I’m not sitting a job interview. I’m here trying to help like minded programmer, therefore if my code doesn’t stand up, then my history isn’t worth jack.

You may also be interested in...

Comments and Discussions

GeneralProblem with CrystallReport And SQL Pin
BlueHeaven11-Apr-05 20:55
memberBlueHeaven11-Apr-05 20:55 
GeneralCESAR Pin
cecosr3-Feb-05 13:11
membercecosr3-Feb-05 13:11 
GeneralYou can also hide the mainreport tab and change color Pin
Anonymous17-Nov-04 3:56
sussAnonymous17-Nov-04 3:56 
I looked over every newsgroup I could find, and thanks to the code there was able to adapt this code to hide the status bar AND that nasty little mainreport tab.
Please note comments.

Private Sub FormatReportViewer()
Dim thisObj As Object
Dim MyPageView As CrystalDecisions.Windows.Forms.PageView
Dim tcontrol As Windows.Forms.TabControl
'(This sample crystalreportviewer is named crystalviewgrid)
'replace with whatever name you gave your control)
For Each thisObj In CrystalViewGrid.Controls
'yes, of course the names are case sensitive!
'(they are StatusBar and PageView and none other!)
Select Case UCase(thisObj.GetType.Name)
CType(thisObj, StatusBar).Visible = False
MyPageView = CType(thisObj, CrystalDecisions.Windows.Forms.PageView)
tcontrol = CType(MyPageView.Controls(0), TabControl)
With tcontrol
'these three lines together effectively make tab invisible.
'comment out if you want to show the tab's text.
.ItemSize = New Size(0, 1)
.SizeMode = TabSizeMode.Fixed
.Appearance = TabAppearance.Buttons
'the crystalreportviewer must be totally drawn before you
'have a tabpage. So you have to call formatreportviewer
'after it has been drawn for the following to work.
If .TabPages.Count > 0 Then
'set color, this is good even if you have chosen
'to make the the tab invisible, does the border.
'the other properties are useless if invisible!
With .TabPages(0)
.BackColor = Color.CornflowerBlue
.Text = "TABTEXT"
'note .TabPages(0).Visible = False doesn't work!
End With
MessageBox.Show("No tabpage " & _
"drawn yet. Show report before calling this procedure.")
End If
End With
End Select

End Sub
Answerhide the mainreport tab__C# version Pin
zhujj3-Aug-06 9:40
memberzhujj3-Aug-06 9:40 
GeneralAnd a VB version Pin
Martin Koster27-Mar-09 5:35
memberMartin Koster27-Mar-09 5:35 
GeneralCrystal Report Viewer's Search Text Form Pin
Anonymous30-Aug-04 11:20
sussAnonymous30-Aug-04 11:20 
GeneralHiding statusbar without creating tempStatus bar Pin
krsmurali13-Feb-04 6:14
memberkrsmurali13-Feb-04 6:14 
GeneralRe: Hiding statusbar without creating tempStatus bar Pin
Joop,Muis23-May-05 23:11
memberJoop,Muis23-May-05 23:11 
GeneralYour TODO item solved here! Pin
Dries_Neyrinck12-Nov-03 11:39
memberDries_Neyrinck12-Nov-03 11:39 
GeneralRe: Your TODO item solved here! Pin
Anonymous12-Nov-03 12:41
sussAnonymous12-Nov-03 12:41 
Generalselection formula in crystal report viewer Pin
vickorpio16-Oct-03 18:43
membervickorpio16-Oct-03 18:43 
GeneralRe: selection formula in crystal report viewer Pin
Anonymous24-Feb-04 2:46
sussAnonymous24-Feb-04 2:46 
GeneralHelp!!!!! Pin
wabi10-Aug-03 21:29
memberwabi10-Aug-03 21:29 
GeneralStatusBar Hide Pin
wabi28-Jul-03 23:15
memberwabi28-Jul-03 23:15 
GeneralRe: StatusBar Hide Pin
kukkken31-Mar-05 23:56
memberkukkken31-Mar-05 23:56 
GeneralRe: StatusBar Hide Pin
miklovan18-May-05 18:21
membermiklovan18-May-05 18:21 
GeneralYou can rename that MainReport tab too Pin
Trevor Kennedy12-Jul-03 13:12
memberTrevor Kennedy12-Jul-03 13:12 
GeneralRe: You can rename that MainReport tab too Pin
JOHNET2-Nov-03 12:05
memberJOHNET2-Nov-03 12:05 
GeneralRe: You can rename that MainReport tab too Pin
Anonymous19-Jan-04 9:23
sussAnonymous19-Jan-04 9:23 
GeneralRe: You can rename that MainReport tab too Pin
Rubens A. Lucca29-Apr-04 4:37
memberRubens A. Lucca29-Apr-04 4:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170713.1 | Last Updated 28 Apr 2003
Article Copyright 2003 by Andrew Fleming
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid