Skip to main content

Text Editor in VB.NET.

DESCRIPTION:
Create a text editor application. It should perform operation like cut, copy, paste and change in font, color of the selected text.
Public Class Form1
    Dim fontbox As New ColorDialog
    Private Sub FontToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles FontToolStripMenuItem.Click
        Dim fontbox As New FontDialog
        If fontbox.ShowDialog <> Windows.Forms.DialogResult.Cancel Then
            RichTextBox1.SelectionFont = fontbox.Font
        End If
    End Sub
    Private Sub ColorToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles ColorToolStripMenuItem.Click
        If fontbox.ShowDialog <> Windows.Forms.DialogResult.Cancel Then
            RichTextBox1.SelectionColor = fontbox.Color
        End If
    End Sub
    Private Sub CutToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles CutToolStripMenuItem.Click
        RichTextBox1.Cut()
    End Sub

    Private Sub FontBackColorToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles FontBackColorToolStripMenuItem.Click
        If fontbox.ShowDialog <> Windows.Forms.DialogResult.Cancel Then
            RichTextBox1.SelectionBackColor = fontbox.Color
        End If
    End Sub

    Private Sub CopyToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles CopyToolStripMenuItem.Click
        RichTextBox1.Copy()
    End Sub
    Private Sub PasteToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles PasteToolStripMenuItem.Click
        RichTextBox1.Paste()
    End Sub
    Private Sub BackgroundColorToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles BackgroundColorToolStripMenuItem.Click
        If fontbox.ShowDialog <> Windows.Forms.DialogResult.Cancel Then
            RichTextBox1.BackColor = fontbox.Color
        End If
    End Sub
End Class
DESIGNING:

Comments