Link to home
Start Free TrialLog in
Avatar of MattRawling
MattRawling

asked on

Putting a clock into VB and liking to it

I need to put a clock into my VB program. I then need to be able to at the press of a command button enter the time into a desired text box.

Cheers for any help you are able to provide

Matt
Avatar of JoaTex
JoaTex

Hi

Put in a Form:

1 Timer
1 CommonButton
1 TextBox
1 Label

Put This Code:


Option Explicit
Dim myTime

Private Sub Command1_Click()
   Text1.Text = Label1.Caption
End Sub

Private Sub Form_Load()
   Timer1.Enabled = True
   Label1.Caption = Time
End Sub

Private Sub Timer1_Timer()
   myTime = Time
Label1.Caption = myTime
End Sub

Run It
Jo
ooops, Sorry Set Timer1.Interval= 1000
Jo
Avatar of MattRawling

ASKER

Cheers Jo that helps a lot. Just one little thing. How can i find the difference in hours miuntes and seconds between two text boxes which i have entered the time into?
ASKER CERTIFIED SOLUTION
Avatar of JoaTex
JoaTex

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Cheers Jo. Very kind of you. You have greatly improved the chances of me passing my final year dissitation and me actually getting a degree!

Matt
MattRawling:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
Avatar of DanRollins
Moderator, my recommended disposition is:

    Accept JoaTex's comment(s) as an answer.
    *** The dissitation is a sertinty now!

DanRollins -- EE database cleanup volunteer