Click here to Skip to main content
15,897,704 members
Articles / Programming Languages / Visual Basic

Hiding the Crystal Report Viewer's Statusbar

Rate me:
Please Sign up or sign in to vote.
3.50/5 (15 votes)
27 Apr 20032 min read 158K   599   36  
Code to hide the Crystal Report Viewer's statusbar.
Public Class Form1
    Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    Friend WithEvents MyCrystalReportViewer1 As Crystal_Report_Viewer.myCrystalReportViewer
    Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
    Friend WithEvents cmdStatusbar As System.Windows.Forms.Button
    Friend WithEvents cmdToolbar As System.Windows.Forms.Button
    Friend WithEvents cmdGroupTree As System.Windows.Forms.Button
    Friend WithEvents cmdGo As System.Windows.Forms.Button
    Friend WithEvents cmdFind As System.Windows.Forms.Button
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.MyCrystalReportViewer1 = New Crystal_Report_Viewer.myCrystalReportViewer()
        Me.cmdStatusbar = New System.Windows.Forms.Button()
        Me.cmdToolbar = New System.Windows.Forms.Button()
        Me.cmdGroupTree = New System.Windows.Forms.Button()
        Me.TextBox1 = New System.Windows.Forms.TextBox()
        Me.cmdGo = New System.Windows.Forms.Button()
        Me.cmdFind = New System.Windows.Forms.Button()
        Me.SuspendLayout()
        '
        'MyCrystalReportViewer1
        '
        Me.MyCrystalReportViewer1.Anchor = (((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
                    Or System.Windows.Forms.AnchorStyles.Left) _
                    Or System.Windows.Forms.AnchorStyles.Right)
        Me.MyCrystalReportViewer1.DisplayGroupTree = True
        Me.MyCrystalReportViewer1.DisplayStatusbar = True
        Me.MyCrystalReportViewer1.DisplayToolbar = True
        Me.MyCrystalReportViewer1.Location = New System.Drawing.Point(8, 64)
        Me.MyCrystalReportViewer1.Name = "MyCrystalReportViewer1"
        Me.MyCrystalReportViewer1.ReportSource = Nothing
        Me.MyCrystalReportViewer1.Size = New System.Drawing.Size(576, 392)
        Me.MyCrystalReportViewer1.TabIndex = 0
        '
        'cmdStatusbar
        '
        Me.cmdStatusbar.Location = New System.Drawing.Point(8, 8)
        Me.cmdStatusbar.Name = "cmdStatusbar"
        Me.cmdStatusbar.Size = New System.Drawing.Size(104, 23)
        Me.cmdStatusbar.TabIndex = 1
        Me.cmdStatusbar.Text = "Hide Statusbar"
        '
        'cmdToolbar
        '
        Me.cmdToolbar.Location = New System.Drawing.Point(128, 8)
        Me.cmdToolbar.Name = "cmdToolbar"
        Me.cmdToolbar.Size = New System.Drawing.Size(104, 23)
        Me.cmdToolbar.TabIndex = 2
        Me.cmdToolbar.Text = "Hide Toolbar"
        '
        'cmdGroupTree
        '
        Me.cmdGroupTree.Location = New System.Drawing.Point(248, 8)
        Me.cmdGroupTree.Name = "cmdGroupTree"
        Me.cmdGroupTree.Size = New System.Drawing.Size(104, 23)
        Me.cmdGroupTree.TabIndex = 3
        Me.cmdGroupTree.Text = "Hide GroupTree"
        '
        'TextBox1
        '
        Me.TextBox1.Anchor = ((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
                    Or System.Windows.Forms.AnchorStyles.Right)
        Me.TextBox1.Location = New System.Drawing.Point(88, 40)
        Me.TextBox1.Name = "TextBox1"
        Me.TextBox1.Size = New System.Drawing.Size(448, 20)
        Me.TextBox1.TabIndex = 5
        Me.TextBox1.Text = "C:\Program Files\Microsoft Visual Studio .NET\Crystal Reports\Samples\Reports\Gen" & _
        "eral Business\World Sales Report.rpt"
        '
        'cmdGo
        '
        Me.cmdGo.Anchor = (System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right)
        Me.cmdGo.Location = New System.Drawing.Point(544, 40)
        Me.cmdGo.Name = "cmdGo"
        Me.cmdGo.Size = New System.Drawing.Size(40, 23)
        Me.cmdGo.TabIndex = 6
        Me.cmdGo.Text = "Go"
        '
        'cmdFind
        '
        Me.cmdFind.Location = New System.Drawing.Point(8, 40)
        Me.cmdFind.Name = "cmdFind"
        Me.cmdFind.TabIndex = 7
        Me.cmdFind.Text = "Find Report"
        '
        'Form1
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(592, 461)
        Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.cmdFind, Me.cmdGo, Me.TextBox1, Me.cmdGroupTree, Me.cmdToolbar, Me.cmdStatusbar, Me.MyCrystalReportViewer1})
        Me.Name = "Form1"
        Me.Text = "Form1"
        Me.ResumeLayout(False)

    End Sub

#End Region

#Region " Private Event Driven Methods "

    Private Sub cmdStatusbar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdStatusbar.Click
        Me.MyCrystalReportViewer1.DisplayStatusbar = Not Me.MyCrystalReportViewer1.DisplayStatusbar

        If Me.MyCrystalReportViewer1.DisplayStatusbar Then
            Me.cmdStatusbar.Text = "Hide Statusbar"
        Else
            Me.cmdStatusbar.Text = "Show Statusbar"
        End If
    End Sub

    Private Sub cmdToolbar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdToolbar.Click
        Me.MyCrystalReportViewer1.DisplayToolbar = Not Me.MyCrystalReportViewer1.DisplayToolbar

        If Me.MyCrystalReportViewer1.DisplayToolbar Then
            Me.cmdToolbar.Text = "Hide Toolbar"
        Else
            Me.cmdToolbar.Text = "Show Toolbar"
        End If
    End Sub

    Private Sub cmdGroupTree_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdGroupTree.Click
        Me.MyCrystalReportViewer1.DisplayGroupTree = Not Me.MyCrystalReportViewer1.DisplayGroupTree

        If Me.MyCrystalReportViewer1.DisplayGroupTree Then
            Me.cmdGroupTree.Text = "Hide Grouptree"
        Else
            Me.cmdGroupTree.Text = "Show Grouptree"
        End If
    End Sub

    Private Sub cmdGo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdGo.Click
        Me.MyCrystalReportViewer1.ReportSource = Me.TextBox1.Text
    End Sub

    Private Sub cmdFind_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdFind.Click
        Dim dlg As New OpenFileDialog()

        dlg.Title = "Select Crystal Reports file"
        dlg.Filter = "Crystal Reports (*.rpt)|*.rpt|All Files (*.*)|*.*"
        dlg.InitialDirectory = "C:\Program Files\Microsoft Visual Studio.NET\Crystal Reports\Samples\Reports"

        If (dlg.ShowDialog() = DialogResult().OK) Then
            Me.TextBox1.Text = dlg.FileName
        End If

        dlg.Dispose()
        dlg = Nothing
    End Sub

#End Region

End Class

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

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


Written By
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.

Comments and Discussions