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

  1. VERSION 1.0 CLASS
  2. BEGIN
  3.   MultiUse = -1  'True
  4. END
  5. Attribute VB_Name = "Class1"
  6. Attribute VB_GlobalNameSpace = False
  7. Attribute VB_Creatable = True
  8. Attribute VB_PredeclaredId = False
  9. Attribute VB_Exposed = True
  10. Option Explicit
  11.  
  12. Private private_StringProperty As String
  13. Private private_IntegerProperty As Integer
  14.  
  15. Property Let stringProperty(newValue As String)
  16.     
  17.     private_StringProperty = newValue
  18.     
  19. End Property
  20.  
  21. Property Get stringProperty() As String
  22.  
  23.     stringProperty = private_StringProperty
  24.     
  25. End Property
  26.  
  27. Property Let IntegerProperty(newValue As Integer)
  28.     
  29.     If Not IsNumeric(newValue) Then
  30.         MsgBox "Invalid value!"
  31.         Exit Property
  32.     Else
  33.         On Error GoTo BigInt
  34.         private_IntegerProperty = newValue
  35.     End If
  36.     Exit Property
  37.     
  38. BigInt:
  39.     MsgBox "The specified value can't fit in an Integer variable"
  40.     
  41. End Property
  42.  
  43. Property Get IntegerProperty() As Integer
  44.  
  45.     IntegerProperty = private_IntegerProperty
  46.     
  47. End Property
  48.