ToolStrip in Visual Basic .NET

Tags: VB.NET, VB 2008, VB 2010, VB 2012, VB 2013


ToolStrip

This control displays a series of buttons, dropdowns, and other tools.

You can access these tools quickly without navigating through a series of menus, so they are most useful for performing frequently needed tasks.

Menus are more appropriate for commands that are needed not that often.

The following list shows the types of items that a ToolStrip may contain:

  • ToolStripButton
  • ToolStripLabel
  • ToolStripSplitButton
  • ToolStripDropDownButton
  • ToolStripSeparator
  • ToolStripComboBox
  • ToolStripTextBox
  • ToolStripProgressBar

controls

You can click the Smart Tags (Tasks) arrow and click the "Insert Standard Items" to add the standard controls to your ToolStrip control.

smart tags

standard items

At runtime, you can access the controls inside the Items collection, or you can refer to the tools directly by their names.

Private Sub ToolStrip1_Click(sender As Object, e As EventArgs) _
 Handles ToolStrip1.Click
    For Each item As ToolStripItem In ToolStrip1.Items
        ' Do something
   Next
End Sub

Private Sub ToolStrip1_ItemClicked(sender As Object, e As ToolStripItemClickedEventArgs) _
 Handles ToolStrip1.ItemClicked
    If e.ClickedItem.Name = "NewToolStripButton" Then
        ' ToDo: open a new file
    End If
End Sub
                    

Previous Lesson | Next Lesson


Share This

Home | About | Contact | Privacy Policy

Copyright visual-basic-tutorials.com 2017 - All Rights Reserved.