Hi everybody i need a clock that is in time with the system clock but has hours minutes and seconds and are in separate textboxes. can anyone help me out with the code?:thumb:
Printable View
Hi everybody i need a clock that is in time with the system clock but has hours minutes and seconds and are in separate textboxes. can anyone help me out with the code?:thumb:
Welcome to the forums. :wave:
Tryvb.net Code:
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick TextBox1.Text = DateTime.Now.Hour.ToString TextBox2.Text = DateTime.Now.Minute.ToString TextBox3.Text = DateTime.Now.Second.ToString End Sub
Ixnay on the meworkhonay Hack. ;)
:confused:Quote:
Originally Posted by sevenhalo
Dont forget to dtop a timer control on to your form and name it Timer1 for the posted code to work ;)
RobDog888: Your PM box is full :lol:
As usual :D I'll go through it in a bit, in the middle of work and need to make a call.
Back on topic.
Forgot to mention that you will also need to set the .Interval property of the timer so it will update your time display in the textbox to keep in sync with the system time. Set it to 500 or such so it will not place too much of a resource drain and yet stay within a reasonable tolerance of accuracy.
thanks guys
cheers i just tested it and it works fine
Ok, then also as a new member I'll tell you that we like to Resolve our threads once they are solved so other members now your question has been answered. You can go to the Thread Tools menu and select Mark thread as Resolved. ;)
Not to mention that homework help should at least get some kind of rating. Well I guess doing it for them is still help....:lol:
D
I dont see where he states its homework?