I have been designing a program, just for fun, part of it involves counting months, simply adding 1 to a label's caption every time a month passes. The problem is the fact months tend to vary in length, and because this should be fairly accurate(and no, leap years are no problem, I will deal with those my self) at any given time i have tried to code the program in a manner in which each month is treated separately, now without further ado, I'll just give you guys the code.
Code: Select all
Private Sub Form_Load()
Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
Label1.Caption = (Label1.Caption + 1)
Lbl1.Caption = (Lbl1.Caption + 1)
If Label1.Caption = 60 Then
Label2.Caption = (Label2.Caption + 1)
Label1.Caption = 0
End If
If Label2.Caption = 60 Then
Label3.Caption = (Label3.Caption + 1)
Label2.Caption = 0
End If
If Label3.Caption = 24 Then
Label4.Caption = (Label4.Caption + 1)
Label3.Caption = 0
End If
If Lbl1.Caption = 604800 Then
Label5.Caption = (Label5.Caption + 1)
Lbl1.Caption = 0
End If
If Label4.Caption = 31 Then
Label6.Caption = (Label6.Caption + 1)
End If
If Label4.Caption = 59 Then
Label6.Caption = (Label6.Caption + 1)
End If
If Label4.Caption = 90 Then
Label6.Caption = (Label6.Caption + 1)
End If
If Label4.Caption = 120 Then
Label6.Caption = (Label6.Caption + 1)
End If
If Label4.Caption = 151 Then
Label6.Caption = (Label6.Caption + 1)
End If
If Label4.Caption = 181 Then
Label6.Caption = (Label6.Caption + 1)
End If
If Label4.Caption = 212 Then
Label6.Caption = (Label6.Caption + 1)
End If
If Label4.Caption = 243 Then
Label6.Caption = (Label6.Caption + 1)
End If
If Label4.Caption = 273 Then
Label6.Caption = (Label6.Caption + 1)
End If
If Label4.Caption = 304 Then
Label6.Caption = (Label6.Caption + 1)
End If
If Label4.Caption = 334 Then
Label6.Caption = (Label6.Caption + 1)
End If
If Label4.Caption = 365 Then
Label6.Caption = 0
Label4.Caption = 0
End If
End Sub
Label6 months
Thanks in advance for all your help! Happy spudding, and enjoy your summer, or winter!