Advertisement
JayBeeOH

Scope Test

Jun 20th, 2016
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 2.86 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 © 2016. All rights reserved.
  10. '        All trademarks remain the property of their respective owners.
  11. '-------------------------------------------------------------------------------------------
  12. ' Program Name:   Scope Test
  13. '
  14. ' Author:         Joseph L. Bolen
  15. ' Date Created:   20 JUN 2016
  16. '
  17. ' Description:    Demo of Scope of a project/class/module. Note: Default scope is Friend.
  18. '
  19. '                 Documentation is at:
  20. '                   App's Visual Basic .NET code is at http://pastebin.com/Yce66YSD  
  21. '-------------------------------------------------------------------------------------------
  22.  
  23. ' Add reference to UtilitiesLibrary to project.
  24. Public Class MainForm
  25.  
  26.     Private Sub SubmitButton_Click(sender As Object, e As EventArgs) _
  27.         Handles SubmitButton.Click
  28.  
  29.         MessageBox.Show("Form's Text Property is: " & Me.Text)
  30.         LocalUtilities.ShowCaption(Me)
  31.         UtilitiesLibrary.Utilities.ShowCaption(Me)
  32.     End Sub
  33. End Class
  34.  
  35. '-------------------------------------------------------------------------------------------
  36. ' Module Name:    LocalUtilities
  37. '
  38. ' Author:         Joseph L. Bolen
  39. ' Date Created:   20 JUN 2016
  40. '
  41. ' Description:    Note: Default scope is Friend. I have explicitly declared it as Friend for
  42. '                 this demo.
  43. '-------------------------------------------------------------------------------------------
  44.  
  45. Friend Module LocalUtilities
  46.  
  47.     Friend Sub ShowCaption(ByVal form As Form)
  48.  
  49.         MessageBox.Show("LocalUtilities Module - Form's Text Property is: " & form.Text)
  50.     End Sub
  51.  
  52. End Module
  53.  
  54. '-------------------------------------------------------------------------------------------
  55. ' Module Name:    Utilities
  56. '
  57. ' Author:         Joseph L. Bolen
  58. ' Date Created:   20 JUN 2016
  59. '
  60. ' Description:    Note: Default scope is Friend. I have explicitly declared it as Pubic for
  61. '                 this demo. This module is in its own project assembly UtititiesLibrary.
  62. '-------------------------------------------------------------------------------------------
  63.  
  64. ' Add Reference to System.Windows.Forms to project.
  65. Imports System.Windows.Forms
  66.  
  67. Public Module Utilities
  68.  
  69.     Public Sub ShowCaption(ByVal form As Form)
  70.  
  71.         MessageBox.Show("UtilitiesLibrary.Utilities Module - Form's Text Property is: " & form.Text)
  72.     End Sub
  73.  
  74. End Module
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement