home *** CD-ROM | disk | FTP | other *** search
/ Mastering Visual Basic 5 / MasteringVisualBasic5.iso / ch_code / ch13 / calcsrvr / calc.cls < prev    next >
Encoding:
Visual Basic class definition  |  1997-02-20  |  1.0 KB  |  46 lines

  1. VERSION 1.0 CLASS
  2. BEGIN
  3.   MultiUse = -1  'True
  4. END
  5. Attribute VB_Name = "Calc"
  6. Attribute VB_GlobalNameSpace = False
  7. Attribute VB_Creatable = True
  8. Attribute VB_PredeclaredId = False
  9. Attribute VB_Exposed = True
  10. Option Explicit
  11. Private privateRadius As Double
  12. Private privateMsg As String
  13.  
  14. Public Function Sphere(Radius As Double) As Double
  15.     Dim pi As Double
  16.     pi = 3.14159265358979
  17.     'Radius = InputBox("Enter the radius of the sphere")
  18.     Sphere = (4 / 3) * pi * (Radius ^ 3)
  19. End Function
  20.  
  21.  
  22. Public Property Let Message(Msg)
  23.     privateMsg = Msg
  24. End Property
  25.  
  26. Public Property Get Message()
  27.     Beep
  28.     'Default Sound (Sounds in Control Panel)
  29.     Message = privateMsg
  30. End Property
  31.  
  32. Private Sub Class_Initialize()
  33. 'MsgBox "Initializing Class"
  34.     privateMsg = "NO MESSAGE STORED"
  35.  
  36. End Sub
  37.  
  38. Private Sub Class_Terminate()
  39. 'MsgBox "Terminating Class"
  40.     
  41.     If privateMsg <> "NO MESSAGE STORED" Then
  42.         MsgBox ("The message stored in this Class will be lost")
  43.     End If
  44.     
  45. End Sub
  46.