Vous êtes sur la page 1sur 5

Public Class Form1

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

End Sub

'code to copy the text


Private Sub CopyToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles
CopyToolStripMenuItem.Click
Clipboard.SetText(TextBox1.SelectedText)
End Sub

'code to paste the selected text


Private Sub PasteToolStripMenuItem_Click(sender As Object, e As EventArgs)
Handles PasteToolStripMenuItem.Click
TextBox1.SelectedText = Clipboard.GetText
End Sub

'code to cut the selected text and the text is copied from the clipboard
Private Sub CutToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles
CutToolStripMenuItem.Click
Clipboard.SetText(TextBox1.SelectedText)
TextBox1.SelectedText = ""
End Sub

'code to save the existing file


Private Sub SaveToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles
SaveToolStripMenuItem.Click
dlgSave.ShowDialog()
My.Computer.FileSystem.WriteAllText(dlgSave.FileName, TextBox1.Text, False)
End Sub

'code to open the existing file


Private Sub OpenToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles
OpenToolStripMenuItem.Click
If TextBox1.Text.Length <> 0 Then
If MsgBox("Do you want to save changes to Untitled?", MsgBoxStyle.YesNo) = 6
Then
dlgOpen.ShowDialog()
My.Computer.FileSystem.WriteAllText(dlgOpen.FileName, TextBox1.Text, False)

End If
End If
End Sub

'code to open new file


Private Sub NewToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles
NewToolStripMenuItem.Click
If TextBox1.Text.Length <> 0 Then
If MsgBox("Do you want to save changes to Untitled?", MsgBoxStyle.YesNo) = 6
Then
dlgSave.ShowDialog()
My.Computer.FileSystem.WriteAllText(dlgSave.FileName, TextBox1.Text, False)

End If
End If
TextBox1.Clear()
End Sub

'code to exit the application


Private Sub ExitToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles
ExitToolStripMenuItem.Click
If TextBox1.Text.Length <> 0 Then
If MsgBox("Do you want to save changes to Untitled?", MsgBoxStyle.YesNo) = 7
Then
dlgSave.ShowDialog()
My.Computer.FileSystem.WriteAllText(dlgSave.FileName, TextBox1.Text, False)

End If
End If
Me.Close()
End Sub

'code to select all the text


Private Sub SelectAllToolStripMenuItem_Click(sender As Object, e As EventArgs)
Handles SelectAllToolStripMenuItem.Click
TextBox1.SelectAll()
End Sub

'code to set the font style


Private Sub FontToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles
FontToolStripMenuItem.Click
dlgFont.ShowDialog()
TextBox1.Font = dlgFont.Font
End Sub

'code for left alignment


Private Sub LeftToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles
LeftToolStripMenuItem.Click
TextBox1.TextAlign = HorizontalAlignment.Left
End Sub

'code for center/justify alignment


Private Sub CenterToolStripMenuItem_Click(sender As Object, e As EventArgs)
Handles CenterToolStripMenuItem.Click
TextBox1.TextAlign = HorizontalAlignment.Center
End Sub

'code for right alignment


Private Sub RightToolStripMenuItem_Click(sender As Object, e As EventArgs)
Handles RightToolStripMenuItem.Click
TextBox1.TextAlign = HorizontalAlignment.Right
End Sub

'code to set the font color


Private Sub FontColorToolStripMenuItem_Click(sender As Object, e As EventArgs)
Handles FontColorToolStripMenuItem.Click
dlgColor.ShowDialog()
TextBox1.ForeColor = dlgColor.Color
End Sub

'code to set the background color


Private Sub BackColorToolStripMenuItem_Click(sender As Object, e As EventArgs)
Handles BackColorToolStripMenuItem.Click
dlgBg.ShowDialog()
TextBox1.BackColor = dlgBg.Color
End Sub

'code to undo
Private Sub UndoToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles
UndoToolStripMenuItem.Click
TextBox1.Undo()
End Sub

'code to redo
Private Sub RedoToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles
RedoToolStripMenuItem.Click
TextBox1.Undo()
End Sub

'code to show about


Private Sub AboutToolStripMenuItem_Click(sender As Object, e As EventArgs)
Handles AboutToolStripMenuItem.Click
AboutBox1.ShowDialog()
End Sub

'code for Ok
Private Sub dlgOpen_FileOk(sender As Object, e As
System.ComponentModel.CancelEventArgs) Handles dlgOpen.FileOk

End Sub
End Class
PROJECT
IN
TVE
Submitted By:
CAMU, Patricia E.
ROXAS, Hannah Clarisse B.
BEARNEZA, Daianne
REYES, Jerald

Submitted To:
Mrs. Karen Grace M. Sapitula

Vous aimerez peut-être aussi