home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic .NET - Read Less - Learn More / Visual_Basic.NET_Read_Less_Learn_More_Richard_Bowman_Visual_2002.iso / Resources / Code / Ch7-UsingYourClass / Module1.vb < prev   
Text File  |  2001-09-23  |  870b  |  31 lines

  1. Class SampleClass
  2.     Private mProperty1 As String
  3.     Public Function Method1(ByVal val As Integer) As String
  4.         RaiseEvent Event1(val)
  5.         Return "Sample return value from calling Method1"
  6.     End Function
  7.     Public Property Property1() As String
  8.         Get
  9.             Return mProperty1
  10.         End Get
  11.         Set(ByVal Value As String)
  12.             mProperty1 = Value
  13.         End Set
  14.     End Property
  15.     Public Event Event1(ByVal Value As Integer)
  16. End Class
  17.  
  18. Module Module1
  19.     Dim WithEvents myObject As New SampleClass()
  20.  
  21.     Sub Main()
  22.         Console.WriteLine(myObject.Method1(10))
  23.         myObject.Property1 = "Value"
  24.         Console.ReadLine()
  25.     End Sub
  26.  
  27.     Public Sub myObject_Event1(ByVal Value As Integer) Handles myObject.Event1
  28.         Console.WriteLine("The event returned: " & Value)
  29.     End Sub
  30. End Module
  31.