This has 5 buttons (Button1 through Button5) which save, select all, cut, copy and paste.
The save function saves the data in plain text format so it uses .txt for the file extension of the file created by it. Although you can change it to save in rich text format with the appropriate file extension for that.
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Me.Text = "Testing"
Me.CenterToScreen()
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim saveFile1 As New SaveFileDialog()
saveFile1.DefaultExt = "*.txt"
saveFile1.Filter = "Text Files|*.txt"
If (saveFile1.ShowDialog() = System.Windows.Forms.DialogResult.OK) _
And (saveFile1.FileName.Length) > 0 Then
RichTextBox1.SaveFile(saveFile1.FileName, RichTextBoxStreamType.PlainText)
End If
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
If RichTextBox1.SelectionLength = 0 Then
RichTextBox1.Focus()
RichTextBox1.SelectAll()
End If
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
If RichTextBox1.SelectedText <> "" Then
RichTextBox1.Cut()
End If
End Sub
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
If RichTextBox1.SelectionLength > 0 Then
RichTextBox1.Copy()
End If
End Sub
Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
RichTextBox1.Focus()
RichTextBox1.SelectionStart = 0
RichTextBox1.Paste()
End Sub
End Class
Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.
No comments:
Post a Comment