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 MainMenu1 As System.Windows.Forms.MainMenu
    Friend WithEvents MenuItem1 As System.Windows.Forms.MenuItem
    Friend WithEvents mnuFileNew As System.Windows.Forms.MenuItem
    Friend WithEvents MenuItem2 As System.Windows.Forms.MenuItem
    Friend WithEvents mnuFileExit As System.Windows.Forms.MenuItem
    Friend WithEvents MenuItem3 As System.Windows.Forms.MenuItem
    Friend WithEvents mnuEditUndo As System.Windows.Forms.MenuItem
    Friend WithEvents MenuItem4 As System.Windows.Forms.MenuItem
    Friend WithEvents mnuEditCut As System.Windows.Forms.MenuItem
    Friend WithEvents mnuEditCopy As System.Windows.Forms.MenuItem
    Friend WithEvents mnuEditPaste As System.Windows.Forms.MenuItem
    Friend WithEvents MenuItem5 As System.Windows.Forms.MenuItem
    Friend WithEvents mnuEditSelectAll As System.Windows.Forms.MenuItem
    Friend WithEvents MenuItem6 As System.Windows.Forms.MenuItem
    Friend WithEvents mnuViewToolbars As System.Windows.Forms.MenuItem
    Friend WithEvents mnuViewToolbarsMain As System.Windows.Forms.MenuItem
    Friend WithEvents mnuViewToolbarsFormatting As System.Windows.Forms.MenuItem
    Friend WithEvents tbrMain As System.Windows.Forms.ToolBar
    Friend WithEvents tbrFormatting As System.Windows.Forms.ToolBar
    Friend WithEvents ImageList1 As System.Windows.Forms.ImageList
    Friend WithEvents tbnNew As System.Windows.Forms.ToolBarButton
    Friend WithEvents ToolBarButton1 As System.Windows.Forms.ToolBarButton
    Friend WithEvents tbnCut As System.Windows.Forms.ToolBarButton
    Friend WithEvents tbnCopy As System.Windows.Forms.ToolBarButton
    Friend WithEvents tbnPaste As System.Windows.Forms.ToolBarButton
    Friend WithEvents ToolBarButton2 As System.Windows.Forms.ToolBarButton
    Friend WithEvents tbnUndo As System.Windows.Forms.ToolBarButton
    Friend WithEvents ToolBarButton3 As System.Windows.Forms.ToolBarButton
    Friend WithEvents ToolBarButton4 As System.Windows.Forms.ToolBarButton
    Friend WithEvents ToolBarButton5 As System.Windows.Forms.ToolBarButton
    Friend WithEvents ToolBarButton6 As System.Windows.Forms.ToolBarButton
    Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
    Friend WithEvents TextBox2 As System.Windows.Forms.TextBox
    Friend WithEvents ContextMenu1 As System.Windows.Forms.ContextMenu
    Friend WithEvents cmuUndo As System.Windows.Forms.MenuItem
    Friend WithEvents MenuItem7 As System.Windows.Forms.MenuItem
    Friend WithEvents cmuCut As System.Windows.Forms.MenuItem
    Friend WithEvents cmuCopy As System.Windows.Forms.MenuItem
    Friend WithEvents cmuPaste As System.Windows.Forms.MenuItem
    Friend WithEvents MenuItem8 As System.Windows.Forms.MenuItem
    Friend WithEvents cmuSelectAll As System.Windows.Forms.MenuItem
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.components = New System.ComponentModel.Container()
        Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(Form1))
        Me.MainMenu1 = New System.Windows.Forms.MainMenu()
        Me.MenuItem1 = New System.Windows.Forms.MenuItem()
        Me.mnuFileNew = New System.Windows.Forms.MenuItem()
        Me.MenuItem2 = New System.Windows.Forms.MenuItem()
        Me.mnuFileExit = New System.Windows.Forms.MenuItem()
        Me.MenuItem3 = New System.Windows.Forms.MenuItem()
        Me.mnuEditUndo = New System.Windows.Forms.MenuItem()
        Me.MenuItem4 = New System.Windows.Forms.MenuItem()
        Me.mnuEditCut = New System.Windows.Forms.MenuItem()
        Me.mnuEditCopy = New System.Windows.Forms.MenuItem()
        Me.mnuEditPaste = New System.Windows.Forms.MenuItem()
        Me.MenuItem5 = New System.Windows.Forms.MenuItem()
        Me.mnuEditSelectAll = New System.Windows.Forms.MenuItem()
        Me.MenuItem6 = New System.Windows.Forms.MenuItem()
        Me.mnuViewToolbars = New System.Windows.Forms.MenuItem()
        Me.mnuViewToolbarsMain = New System.Windows.Forms.MenuItem()
        Me.mnuViewToolbarsFormatting = New System.Windows.Forms.MenuItem()
        Me.tbrMain = New System.Windows.Forms.ToolBar()
        Me.tbnNew = New System.Windows.Forms.ToolBarButton()
        Me.ToolBarButton1 = New System.Windows.Forms.ToolBarButton()
        Me.tbnCut = New System.Windows.Forms.ToolBarButton()
        Me.tbnCopy = New System.Windows.Forms.ToolBarButton()
        Me.tbnPaste = New System.Windows.Forms.ToolBarButton()
        Me.ToolBarButton2 = New System.Windows.Forms.ToolBarButton()
        Me.tbnUndo = New System.Windows.Forms.ToolBarButton()
        Me.ImageList1 = New System.Windows.Forms.ImageList(Me.components)
        Me.tbrFormatting = New System.Windows.Forms.ToolBar()
        Me.ToolBarButton3 = New System.Windows.Forms.ToolBarButton()
        Me.ToolBarButton4 = New System.Windows.Forms.ToolBarButton()
        Me.ToolBarButton5 = New System.Windows.Forms.ToolBarButton()
        Me.ToolBarButton6 = New System.Windows.Forms.ToolBarButton()
        Me.TextBox1 = New System.Windows.Forms.TextBox()
        Me.TextBox2 = New System.Windows.Forms.TextBox()
        Me.ContextMenu1 = New System.Windows.Forms.ContextMenu()
        Me.cmuUndo = New System.Windows.Forms.MenuItem()
        Me.MenuItem7 = New System.Windows.Forms.MenuItem()
        Me.cmuCut = New System.Windows.Forms.MenuItem()
        Me.cmuCopy = New System.Windows.Forms.MenuItem()
        Me.cmuPaste = New System.Windows.Forms.MenuItem()
        Me.MenuItem8 = New System.Windows.Forms.MenuItem()
        Me.cmuSelectAll = New System.Windows.Forms.MenuItem()
        Me.SuspendLayout()
        '
        'MainMenu1
        '
        Me.MainMenu1.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.MenuItem1, Me.MenuItem3, Me.MenuItem6})
        '
        'MenuItem1
        '
        Me.MenuItem1.Index = 0
        Me.MenuItem1.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.mnuFileNew, Me.MenuItem2, Me.mnuFileExit})
        Me.MenuItem1.Text = "&File"
        '
        'mnuFileNew
        '
        Me.mnuFileNew.Index = 0
        Me.mnuFileNew.Text = "&New"
        '
        'MenuItem2
        '
        Me.MenuItem2.Index = 1
        Me.MenuItem2.Text = "-"
        '
        'mnuFileExit
        '
        Me.mnuFileExit.Index = 2
        Me.mnuFileExit.Text = "E&xit"
        '
        'MenuItem3
        '
        Me.MenuItem3.Index = 1
        Me.MenuItem3.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.mnuEditUndo, Me.MenuItem4, Me.mnuEditCut, Me.mnuEditCopy, Me.mnuEditPaste, Me.MenuItem5, Me.mnuEditSelectAll})
        Me.MenuItem3.Text = "&Edit"
        '
        'mnuEditUndo
        '
        Me.mnuEditUndo.Index = 0
        Me.mnuEditUndo.Shortcut = System.Windows.Forms.Shortcut.CtrlZ
        Me.mnuEditUndo.Text = "&Undo"
        '
        'MenuItem4
        '
        Me.MenuItem4.Index = 1
        Me.MenuItem4.Text = "-"
        '
        'mnuEditCut
        '
        Me.mnuEditCut.Index = 2
        Me.mnuEditCut.Shortcut = System.Windows.Forms.Shortcut.CtrlX
        Me.mnuEditCut.Text = "Cu&t"
        '
        'mnuEditCopy
        '
        Me.mnuEditCopy.Index = 3
        Me.mnuEditCopy.Shortcut = System.Windows.Forms.Shortcut.CtrlC
        Me.mnuEditCopy.Text = "&Copy"
        '
        'mnuEditPaste
        '
        Me.mnuEditPaste.Index = 4
        Me.mnuEditPaste.Shortcut = System.Windows.Forms.Shortcut.CtrlV
        Me.mnuEditPaste.Text = "&Paste"
        '
        'MenuItem5
        '
        Me.MenuItem5.Index = 5
        Me.MenuItem5.Text = "-"
        '
        'mnuEditSelectAll
        '
        Me.mnuEditSelectAll.Index = 6
        Me.mnuEditSelectAll.Shortcut = System.Windows.Forms.Shortcut.CtrlA
        Me.mnuEditSelectAll.Text = "Select &All"
        '
        'MenuItem6
        '
        Me.MenuItem6.Index = 2
        Me.MenuItem6.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.mnuViewToolbars})
        Me.MenuItem6.Text = "&View"
        '
        'mnuViewToolbars
        '
        Me.mnuViewToolbars.Index = 0
        Me.mnuViewToolbars.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.mnuViewToolbarsMain, Me.mnuViewToolbarsFormatting})
        Me.mnuViewToolbars.Text = "&Toolbars"
        '
        'mnuViewToolbarsMain
        '
        Me.mnuViewToolbarsMain.Checked = True
        Me.mnuViewToolbarsMain.Index = 0
        Me.mnuViewToolbarsMain.Text = "&Main"
        '
        'mnuViewToolbarsFormatting
        '
        Me.mnuViewToolbarsFormatting.Index = 1
        Me.mnuViewToolbarsFormatting.RadioCheck = True
        Me.mnuViewToolbarsFormatting.Text = "&Formatting"
        '
        'tbrMain
        '
        Me.tbrMain.Appearance = System.Windows.Forms.ToolBarAppearance.Flat
        Me.tbrMain.Buttons.AddRange(New System.Windows.Forms.ToolBarButton() {Me.tbnNew, Me.ToolBarButton1, Me.tbnCut, Me.tbnCopy, Me.tbnPaste, Me.ToolBarButton2, Me.tbnUndo})
        Me.tbrMain.ButtonSize = New System.Drawing.Size(16, 16)
        Me.tbrMain.DropDownArrows = True
        Me.tbrMain.ImageList = Me.ImageList1
        Me.tbrMain.Name = "tbrMain"
        Me.tbrMain.ShowToolTips = True
        Me.tbrMain.Size = New System.Drawing.Size(294, 25)
        Me.tbrMain.TabIndex = 0
        '
        'tbnNew
        '
        Me.tbnNew.ImageIndex = 0
        Me.tbnNew.ToolTipText = "New"
        '
        'ToolBarButton1
        '
        Me.ToolBarButton1.Style = System.Windows.Forms.ToolBarButtonStyle.Separator
        '
        'tbnCut
        '
        Me.tbnCut.ImageIndex = 2
        Me.tbnCut.ToolTipText = "Cut"
        '
        'tbnCopy
        '
        Me.tbnCopy.ImageIndex = 3
        Me.tbnCopy.ToolTipText = "Copy"
        '
        'tbnPaste
        '
        Me.tbnPaste.ImageIndex = 4
        Me.tbnPaste.ToolTipText = "Paste"
        '
        'ToolBarButton2
        '
        Me.ToolBarButton2.Style = System.Windows.Forms.ToolBarButtonStyle.Separator
        '
        'tbnUndo
        '
        Me.tbnUndo.ImageIndex = 1
        Me.tbnUndo.ToolTipText = "Undo"
        '
        'ImageList1
        '
        Me.ImageList1.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit
        Me.ImageList1.ImageSize = New System.Drawing.Size(16, 16)
        Me.ImageList1.ImageStream = CType(resources.GetObject("ImageList1.ImageStream"), System.Windows.Forms.ImageListStreamer)
        Me.ImageList1.TransparentColor = System.Drawing.Color.Transparent
        '
        'tbrFormatting
        '
        Me.tbrFormatting.Buttons.AddRange(New System.Windows.Forms.ToolBarButton() {Me.ToolBarButton3, Me.ToolBarButton4, Me.ToolBarButton5, Me.ToolBarButton6})
        Me.tbrFormatting.ButtonSize = New System.Drawing.Size(16, 16)
        Me.tbrFormatting.DropDownArrows = True
        Me.tbrFormatting.ImageList = Me.ImageList1
        Me.tbrFormatting.Location = New System.Drawing.Point(0, 25)
        Me.tbrFormatting.Name = "tbrFormatting"
        Me.tbrFormatting.ShowToolTips = True
        Me.tbrFormatting.Size = New System.Drawing.Size(294, 25)
        Me.tbrFormatting.TabIndex = 1
        Me.tbrFormatting.Visible = False
        '
        'ToolBarButton3
        '
        Me.ToolBarButton3.ImageIndex = 5
        '
        'ToolBarButton4
        '
        Me.ToolBarButton4.ImageIndex = 6
        '
        'ToolBarButton5
        '
        Me.ToolBarButton5.ImageIndex = 7
        '
        'ToolBarButton6
        '
        Me.ToolBarButton6.ImageIndex = 8
        '
        'TextBox1
        '
        Me.TextBox1.ContextMenu = Me.ContextMenu1
        Me.TextBox1.Location = New System.Drawing.Point(8, 64)
        Me.TextBox1.Name = "TextBox1"
        Me.TextBox1.Size = New System.Drawing.Size(272, 20)
        Me.TextBox1.TabIndex = 2
        Me.TextBox1.Text = "TextBox1"
        '
        'TextBox2
        '
        Me.TextBox2.ContextMenu = Me.ContextMenu1
        Me.TextBox2.Location = New System.Drawing.Point(8, 96)
        Me.TextBox2.Name = "TextBox2"
        Me.TextBox2.Size = New System.Drawing.Size(272, 20)
        Me.TextBox2.TabIndex = 3
        Me.TextBox2.Text = "TextBox2"
        '
        'ContextMenu1
        '
        Me.ContextMenu1.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.cmuUndo, Me.MenuItem7, Me.cmuCut, Me.cmuCopy, Me.cmuPaste, Me.MenuItem8, Me.cmuSelectAll})
        '
        'cmuUndo
        '
        Me.cmuUndo.Index = 0
        Me.cmuUndo.Shortcut = System.Windows.Forms.Shortcut.CtrlZ
        Me.cmuUndo.Text = "Undo"
        '
        'MenuItem7
        '
        Me.MenuItem7.Index = 1
        Me.MenuItem7.Text = "-"
        '
        'cmuCut
        '
        Me.cmuCut.Index = 2
        Me.cmuCut.Shortcut = System.Windows.Forms.Shortcut.CtrlX
        Me.cmuCut.Text = "Cut"
        '
        'cmuCopy
        '
        Me.cmuCopy.Index = 3
        Me.cmuCopy.Shortcut = System.Windows.Forms.Shortcut.CtrlC
        Me.cmuCopy.Text = "Copy"
        '
        'cmuPaste
        '
        Me.cmuPaste.Index = 4
        Me.cmuPaste.Shortcut = System.Windows.Forms.Shortcut.CtrlV
        Me.cmuPaste.Text = "Paste"
        '
        'MenuItem8
        '
        Me.MenuItem8.Index = 5
        Me.MenuItem8.Text = "-"
        '
        'cmuSelectAll
        '
        Me.cmuSelectAll.Index = 6
        Me.cmuSelectAll.Shortcut = System.Windows.Forms.Shortcut.CtrlA
        Me.cmuSelectAll.Text = "Select All"
        '
        'Form1
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(294, 143)
        Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.TextBox2, Me.TextBox1, Me.tbrFormatting, Me.tbrMain})
        Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog
        Me.MaximizeBox = False
        Me.Menu = Me.MainMenu1
        Me.MinimizeBox = False
        Me.Name = "Form1"
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
        Me.Text = "Menu Demo"
        Me.ResumeLayout(False)

    End Sub

#End Region


    Private Sub mnuFileNew_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles mnuFileNew.Click
        'Clear the textboxes
        TextBox1.Text = ""
        TextBox2.Text = ""
        'Set focus to the first textbox
        TextBox1.Focus()
    End Sub


    Private Sub mnuFileExit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles mnuFileExit.Click
        'Close the form and end
        Me.Close()
    End Sub

    Private Sub mnuEditUndo_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles mnuEditUndo.Click
        'Declare a TextBox object and set it to the ActiveControl
        Dim objTextBox As TextBox = Me.ActiveControl

        'Undo the last operation
        objTextBox.Undo()
    End Sub

    Private Sub mnuEditCut_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles mnuEditCut.Click
        'Declare a TextBox object and set it to the ActiveControl
        Dim objTextBox As TextBox = Me.ActiveControl

        'Copy the text to the clipboard and clear the field
        objTextBox.Cut()
    End Sub


    Private Sub mnuEditCopy_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles mnuEditCopy.Click
        'Declare a TextBox object and set it to the ActiveControl
        Dim objTextBox As TextBox = Me.ActiveControl

        'Copy the text to the clipboard
        objTextBox.Copy()
    End Sub


    Private Sub mnuEditPaste_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles mnuEditPaste.Click
        'Declare a TextBox object and set it to the ActiveControl
        Dim objTextBox As TextBox = Me.ActiveControl

        'Copy the data from the clipboard to the textbox
        objTextBox.Paste()
    End Sub

    Private Sub mnuEditSelectAll_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles mnuEditSelectAll.Click
        'Declare a TextBox object and set it to the ActiveControl
        Dim objTextBox As TextBox = Me.ActiveControl

        'Select all text
        objTextBox.SelectAll()
    End Sub


    Private Sub mnuViewToolbarsMain_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles mnuViewToolbarsMain.Click
        'Toggle the View\Toolbars\Main menu item Checked property
        mnuViewToolbarsMain.Checked = Not mnuViewToolbarsMain.Checked

        'Toggle the visibility of the Main toobar
        tbrMain.Visible = Not tbrMain.Visible
    End Sub


    Private Sub mnuViewToolbarsFormatting_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles mnuViewToolbarsFormatting.Click
        'Toggle the View\Toolbars\Formatting menu item Checked property
        mnuViewToolbarsFormatting.Checked = Not _
        mnuViewToolbarsFormatting.Checked

        'Toggle the visibility of the Formatting toolbar
        tbrFormatting.Visible = Not tbrFormatting.Visible
    End Sub


    Private Sub tbrMain_ButtonClick(ByVal sender As Object, ByVal e As System.Windows.Forms.ToolBarButtonClickEventArgs) Handles tbrMain.ButtonClick
        Select Case tbrMain.Buttons.IndexOf(e.Button)
            Case 0  'New
                'Call the corresponding menu item
                mnuFileNew_Click(Nothing, Nothing)
            Case 1  'Separator
            Case 2  'Cut
                'Call the corresponding menu item
                mnuEditCut_Click(Nothing, Nothing)
            Case 3  'Copy
                'Call the corresponding menu item
                mnuEditCopy_Click(Nothing, Nothing)
            Case 4  'Paste
                'Call the corresponding menu item
                mnuEditPaste_Click(Nothing, Nothing)
            Case 5  'Separator
            Case 6  'Undo
                'Call the corresponding menu item
                mnuEditUndo_Click(Nothing, Nothing)
        End Select
    End Sub


    Private Sub cmuUndo_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmuUndo.Click
        'Call the corresponding menu item
        mnuEditUndo_Click(Nothing, Nothing)
    End Sub


    Private Sub cmuCut_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmuCut.Click
        'Call the corresponding menu item
        mnuEditCut_Click(Nothing, Nothing)
    End Sub


    Private Sub cmuCopy_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmuCopy.Click
        'Call the corresponding menu item
        mnuEditCopy_Click(Nothing, Nothing)
    End Sub


    Private Sub cmuPaste_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmuPaste.Click
        'Call the corresponding menu item
        mnuEditPaste_Click(Nothing, Nothing)
    End Sub


    Private Sub cmuSelectAll_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmuSelectAll.Click
        'Call the corresponding menu item
        mnuEditSelectAll_Click(Nothing, Nothing)
    End Sub


    Private Sub ToggleMenus()
        'Declare a TextBox object and set it to the ActiveControl
        Dim objTextBox As TextBox = Me.ActiveControl

        'Toggle the Edit\Undo menu item
        mnuEditUndo.Enabled = objTextBox.CanUndo
        'Toggle the Undo context menu item
        cmuUndo.Enabled = objTextBox.CanUndo
        'Toggle the Undo toolbar button
        tbrMain.Buttons(6).Enabled = objTextBox.CanUndo

        'Toggle the Edit\Cut menu item
        mnuEditCut.Enabled = objTextBox.SelectionLength
        'Toggle the Cut context menu item
        cmuCut.Enabled = objTextBox.SelectionLength
        'Toggle the Cut toolbar button
        tbrMain.Buttons(2).Enabled = objTextBox.SelectionLength

        'Toggle the Edit\Copy menu item
        mnuEditCopy.Enabled = objTextBox.SelectionLength
        'Toggle the Copy context menu item
        cmuCopy.Enabled = objTextBox.SelectionLength
        'Toggle the Copy toolbar button
        tbrMain.Buttons(3).Enabled = objTextBox.SelectionLength

        'Toggle the Edit\Paste menu item
        mnuEditPaste.Enabled = _
            Clipboard.GetDataObject().GetDataPresent(DataFormats.Text)
        'Toggle the Paste context menu item
        cmuPaste.Enabled = _
             Clipboard.GetDataObject().GetDataPresent(DataFormats.Text)
        'Toggle the Paste toolbar button
        tbrMain.Buttons(4).Enabled = _
              Clipboard.GetDataObject().GetDataPresent(DataFormats.Text)

        'Toggle the Edit\Select All menu item
        mnuEditSelectAll.Enabled = objTextBox.SelectionLength < _
             objTextBox.Text.Length
        'Toggle the Select All context menu item
        cmuSelectAll.Enabled = objTextBox.SelectionLength < _
             objTextBox.Text.Length

    End Sub


    Private Sub TextBox1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles TextBox1.MouseMove
        'Toggle the menu items and toolbar buttons
        ToggleMenus()
    End Sub


    Private Sub TextBox2_MouseMove(ByVal sender As Object, ByVal e As _
      System.Windows.Forms.MouseEventArgs) Handles TextBox2.MouseMove
        'Toggle the menu items and toolbar buttons
        ToggleMenus()
    End Sub


End Class
