ActiveReports 6 Online Help
ToolStrip Property
Example 

Gets a reference to the underlying ToolStrip.
Syntax
'Declaration
 
Public ReadOnly Property ToolStrip As ToolStrip
public ToolStrip ToolStrip {get;}
Example
The following code snippets show how to clear the default toolbar and then add a ToolStripComboBox and ToolStripButtons (Load RDF, Export) with the Click event handlers:
Dim WithEvents tsb As ToolStripButton
    Dim WithEvents tsbe As ToolStripButton

    Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Dim ts As ToolStrip = arvMain.Toolbar.ToolStrip
        ts.Items.Clear()

        tsb = New ToolStripButton("Load RDF")

        Dim tscb As New ToolStripComboBox("ExportList")
        tscb.ToolTipText = "Export filters"
        tscb.Items.AddRange(New String() {"PDF", "Excel", "RTF"})

        tsbe = New ToolStripButton("Export")

        ts.Items.Add(tsb)
        ts.Items.Add(New ToolStripSeparator())
        ts.Items.Add(tscb)
        ts.Items.Add(New ToolStripSeparator())
        ts.Items.Add(tsbe)
    End Sub

    Private Sub tsb_Click(ByVal sender As Object, ByVal e As EventArgs) Handles tsb.Click
        Dim dlgOpenFile As New OpenFileDialog()
        dlgOpenFile.CheckFileExists = True
        dlgOpenFile.DefaultExt = "rdf"
        dlgOpenFile.Filter = "Report files (*.rdf)|*.rdf"
        If dlgOpenFile.ShowDialog() = DialogResult.OK Then
            arvMain.Document.Load(dlgOpenFile.FileName)
        End If
    End Sub

    Private Sub tsbe_Click(ByVal sender As Object, ByVal e As EventArgs) Handles tsbe.Click
        Dim ts As ToolStrip = arvMain.Toolbar.ToolStrip
        Dim tscb As ToolStripComboBox = CType(ts.Items("ExportList"), ToolStripComboBox)
        If tscb.SelectedItem <> Nothing Then
            Select Case tscb.SelectedItem.ToString()
                Case "PDF"
                    ' add code for exporting to PDF here
                Case "Excel"
                    ' add code for exporting to Excel here
                Case "RTF"
                    ' add code for exporting to RTF here
                Case Else
            End Select
        End If
    End Sub
private void frmMain_Load(object sender, EventArgs e)
        {
            ToolStrip ts = arvMain.Toolbar.ToolStrip;
            ts.Items.Clear();

            ToolStripButton tsb = new ToolStripButton("Load RDF");
            tsb.Click += new EventHandler(tsb_Click);

            ToolStripComboBox tscb = new ToolStripComboBox("ExportList");
            tscb.ToolTipText = "Export filters";
            tscb.Items.AddRange(new string[] { "PDF", "Excel", "RTF" });

            ToolStripButton tsbe = new ToolStripButton("Export");
            tsbe.Click += new EventHandler(tsbe_Click);

            ts.Items.Add(tsb);
            ts.Items.Add(new ToolStripSeparator());
            ts.Items.Add(tscb);
            ts.Items.Add(new ToolStripSeparator());
            ts.Items.Add(tsbe);
        }

        void tsb_Click(object sender, EventArgs e)
        {
            OpenFileDialog dlgOpenFile = new OpenFileDialog();
            dlgOpenFile.CheckFileExists = true;
            dlgOpenFile.DefaultExt = "rdf";
            dlgOpenFile.Filter = "Report files (*.rdf)|*.rdf";
            if (dlgOpenFile.ShowDialog()== DialogResult.OK)
            {
                arvMain.Document.Load(dlgOpenFile.FileName);
            }
        }

        void tsbe_Click(object sender, EventArgs e)
        {
            ToolStrip ts = arvMain.Toolbar.ToolStrip;
            ToolStripComboBox tscb = (ts.Items["ExportList"] as ToolStripComboBox);
            if (tscb.SelectedItem != null)
            {
                switch (tscb.SelectedItem.ToString())
                {
                    case "PDF":
                        // add code for exporting to PDF here
                        break;
                    case "Excel":
                        // add code for exporting to Excel here
                        break;
                    case "RTF":
                        // add code for exporting to RTF here
                        break;
                    default:
                        break;
                }
            }
        }
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

ToolbarObject Class
ToolbarObject Members

Send Feedback