Option Explicit
Dim intMonths As Integer
Dim strYears As String
Dim sngYears As Single
Private Sub cmdCow_Click()
'Calculate Dog Years
sngYears = (5 * intMonths) / 12
'Hide Instructons
lblInstructions.Visible = False
'Display Results
strYears = Format(sngYears, "###.0")
lblOutputCowYears.Caption = "In cow years, you are " & strYears & " years old."
lblOutputCowYears.Visible = True
End Sub
Private Sub cmdDog_Click()
'Calculate Dog Years
sngYears = (7 * intMonths) / 12
'Hide Instructons
lblInstructions.Visible = False
'Display Results
strYears = Format(sngYears, "###.0")
lblOutputAnimalYears.Caption = "In dog years, you are " & strYears & " years old."
lblOutputAnimalYears.Visible = True
End Sub
Private Sub cmdExit_Click()
End
End Sub
Private Sub cmdMonths_Click()
'Calculate Months
intMonths = (Val(txtYears.Text) * 12) + Val(txtMonths.Text)
'Display Number of Months Old
lblOutputMonths.Caption = "You are " & intMonths & " months old."
lblOutputMonths.Visible = True
'Display Instructions
lblInstructions.Visible = True
cmdDog.Enabled = True
cmdCow.Enabled = True
cmdMouse.Enabled = True
lblCow.Visible = True
lblMouse.Visible = True
lblInstructions.Visible = True
End Sub
Private Sub cmdMouse_Click()
'Calculate Dog Years
sngYears = (25 * intMonths) / 12
'Hide Instructons
lblInstructions.Visible = False
'Display Results
strYears = Format(sngYears, "###.0")
lblOutputMouseYears.Caption = "In mouse years, you are " & strYears & " years old."
lblOutputMouseYears.Visible = True
End Sub
Private Sub Command1_Click()
End
End Sub
Private Sub Command2_Click()
End Sub
Private Sub command4_Click()
End
End Sub
Private Sub lblOutputMouse_Click()
End Sub
Private Sub txtMonths_Change()
'Enable Human Months Button
cmdMonths.Enabled = True
'Disable Dog Command Button
cmdDog.Enabled = False
lblOutputAnimalYears.Visible = False
End Sub
Private Sub txtMonths_GotFocus()
'Select Text
txtMonths.SelStart = 0
txtMonths.SelLength = Len(txtMonths.Text)
End Sub
Private Sub txtYears_Change()
'Enable Human Months Button
cmdMonths.Enabled = True
End Sub
Private Sub txtYears_GotFocus()
'Select Text
txtYears.SelStart = 0
txtYears.SelLength = Len(txtYears.Text)
End Sub