|
Re: Visual Basic Current Time On Form
I made a computer calander for someone not long ago, I think you may find the code helpful for what you're looking for , here is the entire code from the 1 I made
How to set or fill out the Properties:
Form Name Calendar:
Caption = My Computer Calendar
BorderStyle = 1 - Fixed Single
Timer1 Timer1:
Interval = 1000
Label1 Name Day:
BackStyle = 0 - Transparent
Caption = Sunday
FontName = Times New Roman
FontBold = True
FontSize = 24
Label2 Name Time:
BackStyle = 0 - Transparent
Caption = 00:00:00 PM
FontName = Times New Roman
FontBold = True
FontSize = 24
Label3 Name Year:
BackStyle = 0 - Transparent
Alignment = 2 - Center
Caption = 2008
FontName = Times New Roman
FontBold = True
FontSize = 24
Label4 Number:
BackStyle = 0 - Transparent
Alignment = 2 - Center
Caption = 30
FontName = Arial
FontBold = True
FontSize = 72
Label5 Month:
BackStyle = 0 - Transparent
Alignment = 2 - Center
Caption = March
FontName = Times New Roman
FontBold = True
FontSize = 24
Now for the Code:
General Declarations:
timDisplay Timer Event:
Private Sub Timer1_Timer()
Dim Today As Variant
Today = Now
Day.Caption = Format(Today, "dddd")
Month.Caption = Format(Today, "mmmm")
Year.Caption = Format(Today, "yyyy")
Number.Caption = Format(Today, "d")
Time.Caption = Format(Today, "h:mm:ss ampm")
End Sub
|