Thursday, January 18, 2007

Computer Class Codes, Obvious Writing Laziness Ensues

Change color:
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
If ColorDialog1.ShowDialog = DialogResult.OK Then
RichTextBox1.ForeColor = ColorDialog1.Color
End If
End Sub

Open file:
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
If OpenFileDialog1.ShowDialog = DialogResult.OK Then
RichTextBox1.Text = Text.Copy(OpenFileDialog1.FileName)
End If
End Sub

Save file:
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
If SaveFileDialog1.ShowDialog = DialogResult.OK Then
RichTextBox1.SaveFile(SaveFileDialog1.FileName)
End If

Change font:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If FontDialog1.ShowDialog = DialogResult.OK Then
RichTextBox1.Font = FontDialog1.Font
End If

Cut command:
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
RichTextBox1.Cut()
End Sub

Copy command:
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
RichTextBox1.Copy()
End Sub

Paste command:
Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
RichTextBox1.Paste()
End Sub
End Class

0 pokes: