How would I get a label box to just display the current year?
Thanks
Aaron
Printable View
How would I get a label box to just display the current year?
Thanks
Aaron
:)
VB Code:
Option Explicit Private Sub Form_Load() Label1.Caption = Year(Date) End Sub
That was hard :-p, thanks a lot :).
koolzap351:
The following code will put the current date into a text box when you click on the text box:
Private Sub txtDate_Click()
If txtDate.Text <> CStr(Date) Then
txtDate.Text = Date
End If
End Sub
If you want to have the date appear in the text box when the form loads, then put this code in the form_load event instead of the txtDate_Click event.
This code will put the current time into a text box when you click on the text box:
Private Sub txtTime_Click()
If txtTime.Text <> CStr(Time) Then
txtTime.Text = Time
End If
End Sub
Again, if you want the time to appear in the text box when the form is loaded this code need to be in the form_load event.
This should work.
I know. I almost tired myself out for the day. :D ;)
Btw, its just called a Label control and not a Label Box. :)