JayBeeOH

TxtEditor - File Exit Option

Feb 28th, 2015
623
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 2.67 KB | None | 0 0
  1. '------------------------------------------------------------------------------------------
  2. '           Notice of My Copyright and Intellectual Property Rights
  3. '
  4. ' Any intellectual property contained within the program by Joseph L. Bolen remains the
  5. ' intellectual property of the Joseph L. Bolen. This means that no person may distribute,
  6. ' publish or provide such intellectual property to any other person or entity for any
  7. ' reason, commercial or otherwise, without the express written permission of Joseph L. Bolen.
  8. '
  9. '                 Copyright © 2015. All rights reserved.
  10. '        All trademarks remain the property of their respective owners.
  11. '-------------------------------------------------------------------------------------------
  12. ' Program Name:   Text Editor
  13. '
  14. ' Author:         Joseph L. Bolen
  15. ' Date Created:   Feb 2015
  16. '
  17. ' Description:    Simple plain text editor program with printing ability.
  18. '
  19. '                 Documentation is at:
  20. '                   App's screen image is at: http://imgur.com/TzWs9kO
  21. '                   App's screen design time specs at: http://pastebin.com/bhinRQ5d
  22. '                   App's Visual Basic .NET Event Procedures & TODO's is at
  23. '                       http://pastebin.com/UZ4tcEpE
  24. '                   App's Visual Basic .NET code is at http://pastebin.com/u/jaybeeoh
  25. '                   Video tutorial at YouTube: http://www.youtube.com/user/bolenpresents
  26. '-------------------------------------------------------------------------------------------
  27.  
  28. #Region "  MainForm Events"
  29.  
  30.     ' Upon form closing, save user settings and check if document has changed.
  31.     Private Sub MainForm_FormClosing(sender As Object, e As FormClosingEventArgs) _
  32.         Handles Me.FormClosing
  33.  
  34.         ' SaveSettings()
  35.         If SaveChanges() Then
  36.             SaveToolStripMenuItem_Click(sender, e)
  37.         End If
  38.     End Sub
  39.  
  40. #End Region
  41.  
  42. #Region " Edit Menu"
  43. '
  44. '
  45. '
  46.     ' If MyTextBox has been modifed, check to see if changes should be saved.
  47.     Private Function SaveChanges() As Boolean
  48.  
  49.         If (MyTextBox.Modified) AndAlso (Not String.IsNullOrWhiteSpace(MyTextBox.Text)) Then
  50.             If MsgBoxResult.Yes = MessageBox.Show("Do you want to save your changes?",
  51.                             "Save Changes",
  52.                             MessageBoxButtons.YesNo,
  53.                             MessageBoxIcon.Question) Then
  54.                 Return True
  55.             End If
  56.         End If
  57.         Return False
  58.     End Function
  59. '
  60. '
  61. '
  62.     ' File Exit program.
  63.     Private Sub ExitToolStripMenuItem_Click(sender As Object, e As EventArgs) _
  64.         Handles ExitToolStripMenuItem.Click
  65.  
  66.         Me.Close()
  67.     End Sub
  68.  
  69. #End Region
Advertisement
Add Comment
Please, Sign In to add comment