Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- '------------------------------------------------------------------------------------------
- ' Notice of My Copyright and Intellectual Property Rights
- '
- ' Any intellectual property contained within the program by Joseph L. Bolen remains the
- ' intellectual property of the Joseph L. Bolen. This means that no person may distribute,
- ' publish or provide such intellectual property to any other person or entity for any
- ' reason, commercial or otherwise, without the express written permission of Joseph L. Bolen.
- '
- ' Copyright © 2015. All rights reserved.
- ' All trademarks remain the property of their respective owners.
- '-------------------------------------------------------------------------------------------
- ' Program Name: Text Editor
- ' Author: Joseph L. Bolen
- ' Date Created: Feb 2015
- '
- ' Description: Simple plain text editor program with printing ability.
- '
- ' Documentation is at:
- ' App's screen image is at: http://imgur.com/TzWs9kO
- ' App's screen design time specs at: http://pastebin.com/bhinRQ5d
- ' App's Visual Basic .NET Event Procedures & TODO's is at
- ' http://pastebin.com/UZ4tcEpE
- ' App's Visual Basic .NET code is at http://pastebin.com/u/jaybeeoh
- ' Video tutorial at YouTube: http://www.youtube.com/user/bolenpresents
- '-------------------------------------------------------------------------------------------
- Public Class MainForm
- #Region " Edit Menu"
- #Region " Undo / Cut / Copy / Paste / Delete"
- ' Edit Undo option.
- Private Sub UndoToolStripMenuItem_Click(sender As Object, e As EventArgs) _
- Handles UndoToolStripMenuItem.Click
- With MyTextBox
- If .CanUndo Then
- .Undo()
- .ClearUndo()
- End If
- End With
- End Sub
- ' Edit Cut option - Cut selected text to the Clipboard.
- Private Sub CutToolStripMenuItem_Click(sender As Object, e As EventArgs) _
- Handles CutToolStripMenuItem.Click,
- CutToolStripButton.Click,
- DeleteToolStripMenuItem.Click
- If MyTextBox.SelectedText <> String.Empty Then
- MyTextBox.Cut()
- End If
- End Sub
- ' Edit Copy option - Copy the selected text to the Clipboard.
- Private Sub CopyToolStripMenuItem_Click(sender As Object, e As EventArgs) _
- Handles CopyToolStripMenuItem.Click,
- CopyToolStripButton.Click
- If MyTextBox.SelectionLength > 0 Then
- MyTextBox.Copy()
- End If
- End Sub
- ' Edit Paste option - If Clipboard has text, paste to textbox.
- Private Sub PasteToolStripMenuItem_Click(sender As Object, e As EventArgs) _
- Handles PasteToolStripMenuItem.Click,
- PasteToolStripButton.Click
- If Clipboard.GetDataObject().GetDataPresent(DataFormats.Text) Then
- If MyTextBox.SelectionLength > 0 Then
- ' Paste over currently selected text.
- If MessageBox.Show(Me, "Do you want to paste over current selection?",
- "Paste Over Confirm",
- MessageBoxButtons.YesNo,
- MessageBoxIcon.Question,
- MessageBoxDefaultButton.Button1) = DialogResult.No Then
- ' Move selection to the point after the current selection and paste.
- MyTextBox.SelectionStart = MyTextBox.SelectionStart + MyTextBox.SelectionLength
- End If
- End If
- ' Paste current text in Clipboard into text box.
- MyTextBox.Paste()
- End If
- End Sub
- #End Region
- #Region " Find / Find Next / Replace"
- ' Edit Find option.
- Private Sub FindToolStripMenuItem_Click(sender As Object, e As EventArgs) _
- Handles FindToolStripMenuItem.Click
- 'TODO: Code Edit Find option.
- MsgBox("Code Edit Find option.")
- End Sub
- ' Edit Find Next option.
- Private Sub FindNextToolStripMenuItem_Click(sender As Object, e As EventArgs) _
- Handles FindNextToolStripMenuItem.Click
- 'TODO: Code Edit Find Next option.
- MsgBox("Code Edit Find Next option.")
- End Sub
- ' Edit Replace option.
- Private Sub ReplaceToolStripMenuItem_Click(sender As Object, e As EventArgs) _
- Handles ReplaceToolStripMenuItem.Click
- 'TODO: Code Edit Replace option.
- MsgBox("Code Edit Replace option.")
- End Sub
- #End Region
- #Region " Select All / Time/Date Insert"
- ' Edit Select All option.
- Private Sub SelectAllToolStripMenuItem_Click(sender As Object, e As EventArgs) _
- Handles SelectAllToolStripMenuItem.Click
- MyTextBox.SelectAll()
- End Sub
- ' Edit Time/Date option - Inserted time and date at cursor location option.
- Private Sub TimeDateToolStripMenuItem_Click(sender As Object, e As EventArgs) _
- Handles TimeDateToolStripMenuItem.Click
- MyTextBox.SelectedText = Now.ToShortTimeString & " " & Today.ToShortDateString
- MyTextBox.Modified = True
- End Sub
- #End Region
- #End Region
- End Class
Advertisement
Add Comment
Please, Sign In to add comment