Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Option Explicit
'in General Declaration
Public Size As Integer
Public Sub Bark()
If Me.Size = 1 Then
MsgBox "WOOF WOOF"
Else
MsgBox "warf warf"
End If
End Sub
Option Explicit
'General Declarations section
Dim Fido As DogClass.Dog
Dim Fifi As DogClass.Dog
Private Sub Form_Load()
Set Fido = New DogClass.Dog
Fido.Size = 1
Set Fifi = New DogClass.Dog
Fifi.Size = 0
End Sub
Private Sub cmdTestDogClass_Click()
Fido.Bark
Fifi.Bark
End Sub
Enum DogSize
Big = 1
Little = 0
End Enum
Public Size As DogSize
'Public Size as Integer
Private Sub Form_Load()
Set Fido = New DogClass.Dog
Fido.Size = Big
Set Fifi = New DogClass.Dog
Fifi.Size = Little
End Sub
Public Sub Bark()
If Me.Size = Big Then
MsgBox "WOOF WOOF"
Else
MsgBox "warf warf"
End If
End Sub
'Public Size As Integer
'Public Size As DogSize
Private cSize As DogSize 'You can use Dim here too
Public Property Get Size() As DogSize
Size = cSize
End Property
Public Property Let Size(x As DogSize)
cSize = x
End Property
Public Sub Bark()
MsgBox "yip yip"
End Sub
Public Function CreatePuppy() As Puppy
Set CreatePuppy = New Puppy
End Function
Option Explicit
Dim Fido As DogClass.Dog
Dim Fifi As DogClass.Dog
Dim Rover As DogClass.Puppy
Private Sub Form_Load()
Set Fido = New DogClass.Dog
Fido.Size = Big
Set Fifi = New DogClass.Dog
Fifi.Size = Little
Set Rover = Fido.CreatePuppy
End Sub
Private Sub cmdTestDogClass_Click()
Fido.Bark
Fifi.Bark
Rover.Bark
End Sub
Private cParent As Dog
Public Property Get Parent() As Dog
Set Parent = cParent
End Property
Friend Sub SetParent(x As Dog)
Set cParent = x
End Sub
Public Sub Bark()
If Me.Parent.Size = Big Then
MsgBox "yap yap"
Else
MsgBox "yip yip"
End If
End Sub
Public Function CreatePuppy() As Puppy
Set CreatePuppy = New Puppy
CreatePuppy.SetParent Me
End Function
Option Explicit
Dim Fido As DogClass.Dog
Dim Fifi As DogClass.Dog
Dim Rover As DogClass.puppy
Dim Lassie As DogClass.puppy
Private Sub Form_Load()
Set Fido = New DogClass.Dog
Fido.Size = Big
Set Fifi = New DogClass.Dog
Fifi.Size = Little
Set Rover = Fifi.CreatePuppy
Set Lassie = Fido.CreatePuppy
End Sub
Private Sub cmdTestDogClass_Click()
Fido.Bark
Fifi.Bark
Rover.Bark
Lassie.Bark
End Sub