Public Class Form1

    Private Sub 開啟舊檔ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 開啟舊檔ToolStripMenuItem.Click
        Call OpenFile()      '呼叫副程式OpenFile()
    End Sub

    Private Sub 儲存檔案SToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 儲存檔案SToolStripMenuItem.Click
        Call SaveFile()      '呼叫副程式SaveFile()
    End Sub

    Private Sub 結束ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 結束ToolStripMenuItem.Click
        Dim reply As Short
        reply = MsgBox("結束程式嗎？", MsgBoxStyle.Question + MsgBoxStyle.YesNo, "簡易記事本")
        If reply = 6 Then    '數值6代表按下是鈕
            Call SaveFile()  '呼叫副程式SaveFile()
            End
        End If
    End Sub

    Private Sub 剪下ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 剪下ToolStripMenuItem.Click
        If TextBox1.SelectedText <> "" Then    '判斷是否選取文字
            TextBox1.Cut()
        End If
    End Sub

    Private Sub 複製CToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 複製CToolStripMenuItem.Click
        If TextBox1.SelectedText <> "" Then    '判斷是否選取文字
            TextBox1.Copy()
        End If
    End Sub

    Private Sub 貼上PToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 貼上PToolStripMenuItem.Click
        TextBox1.Paste()
    End Sub

    Private Sub 清除DToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 清除DToolStripMenuItem.Click
        TextBox1.Clear()
    End Sub
End Class
