Private RunTimes As Long
Private RunDate As Date
Private Sub Form_Load()
RunTimes = GetSetting("CounterApp", "Counts", _
"NumTimes", 0) + 1
RunDate = GetSetting("CounterApp", "Counts", _
"LastTime", Now)
If RunTimes > 1 Then
lblTimes.Caption = "This program has been run " & _
Format$(RunTimes) & " times."
lblDate.Caption = "The last was at " & _
Format$(RunDate) & "."
Else
lblTimes.Caption = "This is the program's first " & _
"run."
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
SaveSetting "CounterApp", "Counts", "NumTimes", RunTimes
SaveSetting "CounterApp", "Counts", "LastTime", Now
End Sub
|