473,508 Members | 2,007 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

date and timer on a form

hi,

I'm new to vb.net . I have a problem waking up early. I usually miss my
morning classes. I downloaded some alarm clocks of the internet but most of
them are huge and have extra functionalities. so I decided to make my own
alarm clock. i created my project and made the form. I could display the
time on a textfield but I dont know how to make it increment like a clock
does. would anyone plz start me on the right track ?

thanks
Nov 20 '05 #1
3 1329
Hi,

Add a timer to your form. In the tick event update the textbox
text. Set the timers interval to 1000 and enabled to true.

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Timer1.Tick

TextBox1.Text = Now.ToShortTimeString

End Sub

Ken

---------------------------

"aelhhattabi" <ae*********@rogers.com> wrote in message
news:SN***************@news01.bloor.is.net.cable.r ogers.com...
hi,

I'm new to vb.net . I have a problem waking up early. I usually miss my
morning classes. I downloaded some alarm clocks of the internet but most
of
them are huge and have extra functionalities. so I decided to make my own
alarm clock. i created my project and made the form. I could display the
time on a textfield but I dont know how to make it increment like a clock
does. would anyone plz start me on the right track ?

thanks

Nov 20 '05 #2
Cor
Hi aelhhattabi

There is a greath timer example in the resource kit at GDI

http://msdn.microsoft.com/vbasic/vbrkit/default.aspx

And if you have problems installing it

http://msdn.microsoft.com/vbasic/vbr...q/#installvdir

You really will apriciate it seeing it,

But maybe a little bit disapointed about your own clock

:-(

Cor

I'm new to vb.net . I have a problem waking up early. I usually miss my
morning classes. I downloaded some alarm clocks of the internet but most of them are huge and have extra functionalities. so I decided to make my own
alarm clock. i created my project and made the form. I could display the
time on a textfield but I dont know how to make it increment like a clock
does. would anyone plz start me on the right track ?

thanks

Nov 20 '05 #3
* "aelhhattabi" <ae*********@rogers.com> scripsit:
I'm new to vb.net . I have a problem waking up early. I usually miss my
morning classes. I downloaded some alarm clocks of the internet but most of
them are huge and have extra functionalities. so I decided to make my own
alarm clock. i created my project and made the form. I could display the
time on a textfield but I dont know how to make it increment like a clock
does. would anyone plz start me on the right track ?


Add a timer ('System.Windows.Forms.Timer') to your form, set its
'Interval' property to '500' (milliseconds), then doubleclick it to
create a handler for its 'Tick' event. There you can calculate the
difference between a starting date (for example, stored in a private
variable) with the current date/time ('DateTime.Now') and display it by
calling the resulting 'TimeSpan''s 'ToString' method.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
1840
by: rhaley | last post by:
ugh. Okay, I need to figure out the number of milliseconds between DateTime.Now and the end of the day so that I can make changes based on the date roll-over. I need to implement a Timer so that I...
13
7442
by: Manuel Lopez | last post by:
I have a puzzling form timer problem that I didn't experience prior to Access 2003 (though I'm not sure access 2003 is to blame). Here's the situation: a computer has two access 2003 databases on...
9
1384
by: Zach | last post by:
I would like to express the time with the time continually changing. I can get it to show once, but then it stays that way, using a loop jams. Is there a way to do this?
4
15351
by: Daniel Kaseman | last post by:
How do I convert a date into a serial number? (I'm trying to enter a FROM date and a TO date, then make my PROGRESS BAR show how close I am to the TO date.) get it? I know that MS Excel...
10
16982
by: jerry.ranch | last post by:
I used =now() in a text box and that nicely displays date and time at the moment of opening How would I show updated data? I thought of an event procedure, but which one would I use since...
4
4617
by: grayaii | last post by:
Hi, I have a simple form that handles all its paint functionality like so: this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.Opaque, true); And the entry point to this...
11
2568
by: Hotrod2000 | last post by:
I'm quite new to programming but I'm having problems getting a timer to work in visual studio.net I've created a timer on a form, enabled it and then typed the following code (from the mdsn...
19
2111
lee123
by: lee123 | last post by:
how do i change this code to do dates instead if time: CurrentTime = Format(Time, "hh:mm") If CurrentTime = txtBillTime.Text Then Beep frmAppointment.WindowState = 0...
7
2219
by: wanwan | last post by:
Hi, I'm looking for a better way to do a date/time elapsed event rather than a timer elapsed event. Currently, I wrote my program to use a timer elapsed event set to 1 second, and it checks...
0
7125
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7328
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7388
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
5055
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4709
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3199
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1561
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
767
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
422
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.