You are on page 1of 1

Imports System.Drawing.Printing Public Class Form1 Private Sub SaveToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveToolStripMenuItem.Click SaveFileDialog1.

Filter = "Text File | *.txt" SaveFileDialog1.ShowDialog() RichTextBox1.SaveFile(SaveFileDialog1.FileName) End Sub Private Sub OpenToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OpenToolStripMenuItem.Click OpenFileDialog1.Filter = "Text File | *.txt" OpenFileDialog1.ShowDialog() RichTextBox1.LoadFile(OpenFileDialog1.FileName) End Sub Private Sub ColorToolStripMenuItem_Click(ByVal sender As System.Object, ByVa l e As System.EventArgs) Handles ColorToolStripMenuItem.Click Dim cd = New ColorDialog cd.ShowDialog() RichTextBox1.ForeColor = cd.Color End Sub Private Sub PrintToolStripMenuItem_Click(ByVal sender As System.Object, ByVa l e As System.EventArgs) Handles PrintToolStripMenuItem.Click Dim printDlg As New PrintDialog() Dim printDoc As New PrintDocument() printDoc.DocumentName = "Print Document" printDlg.Document = printDoc printDlg.AllowSelection = True printDlg.AllowSomePages = True If (printDlg.ShowDialog() = DialogResult.OK) Then printDoc.Print() End If End Sub Private Sub FilebowseToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FilebowseToolStripMenuItem.Click FolderBrowserDialog1.ShowDialog() FolderBrowserDialog1.SelectedPath = True End Sub

End Class

You might also like