Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  HOME    TRACKER    Visual Basic

Make An Analogue Clock In VB?

Does anyone have an idea on how to make an analogue clock in visual basic 6?

View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
How Do I Make A Realistic Analogue Clock?
I want to create a small realistic analogue clock, not with just a simple line for a hand. (Hours and Minutes only)
I have in mind a transparent 3D metallic style background graphic for the minute hand that rotates about a point.
I know how to make a borderless form that is transparent except for where the hand is but not a transparent graphic.
Is there a way or rotating a form or a transparent bit map graphic about a point?
I could have 3600 jpegs of each situation and change them each minute but that I would be ashamed to admit that!

Analogue Clock
i want to make an analogue clock. i have a pic same as system clock and a line control. i want that this line rotate acuratly. any idea.

Analogue Clock
do any of yous have an example of an analogue clock ?

if so could you e-mail me a copy (*.zip) format if posible to

if not could you tell me how to make one


Analogue Clock - Think I Got It Right, But Doesn't Work?
Here's the coding I've made for my little Analogue clock, which appears left hand side of the AlarmClock I'm developing.


Option Explicit

' Analogue Clock settings
Const Pi As Single = 3.141592654
Const sFactor60 As Single = Pi / 30
Const sFactor12 As Single = Pi / 6
Const sRotateFactor As Single = Pi / 2
Dim sRadius As Single

Private Sub tmrAnalog2_Timer()
Dim q As Single
' Seconds
q = Format(Time, "s")
ASeconds2.X2 = Cos(q * sFactor60 - sRotateFactor) * sRadius + ASeconds2.X1
ASeconds2.Y2 = Sin(q * sFactor60 - sRotateFactor) * sRadius + ASeconds2.Y1
End Sub

Private Sub TmrAnalog_Timer()
Dim t As Single
' Seconds
t = Format(Time, "s")
ASeconds.X2 = Cos(t * sFactor60 - sRotateFactor) * sRadius + ASeconds.X1
ASeconds.Y2 = Sin(t * sFactor60 - sRotateFactor) * sRadius + ASeconds.Y1

t = Format(Time, "n") + t / 60
AMinutes.X2 = Cos(t * sFactor60 - sRotateFactor) * (sRadius - Screen.TwipsPerPixelX * 5) + ASeconds.X1
AMinutes.Y2 = Sin(t * sFactor60 - sRotateFactor) * (sRadius - Screen.TwipsPerPixelX * 5) + ASeconds.Y1

t = Format(Time, "h") + t / 60
AHours.X2 = Cos(t * sFactor12 - sRotateFactor) * (sRadius - Screen.TwipsPerPixelX * 10) + ASeconds.X1
AHours.Y2 = Sin(t * sFactor12 - sRotateFactor) * (sRadius - Screen.TwipsPerPixelX * 10) + ASeconds.Y1
End Sub

What is wrong with this? Second hand works perfect... But..
Hours and Minutes, seem to be in wrong position???
and Minutes hand is WAY TOO LONG?....

Any suggestions?

[ Here's my problem ]

What I have done wrong at the first place, so it doens't convey the minute and hour hand correctly? I mean, I think I've done some good job here, but hey -0-; I'm getting everything wrong.

All the other source codes of Analogue Clock, I've seen, had it working perfect, yet mine doesn't. Mine seems to be right to me.

As you see in the picture, only thing that works correctly, is the "Second" (Var = ASeconds) hand. Minute hand and Hour hand seems to be WAY OFF the REAL-TIME. (My time at the Screen Shot was ' 12:53 Pm '.

Also another problem comes with the " sRadius " and " Screen.TwipsPerPixel ", because my Minute hand seems to be VERY long... hmm....

I'm really trying to get this thing working...

SO can any experts look through the code, and allocate me what is wrong and what I've missed out on?

Thank you.

Creating An Analogue Desktop Clock
Anybody, could you please help me with creating a desktop analogue clock. In boxes and coding, please?

WordClock - Analogue Clock With Words For Hands...
Demonstrates how to draw text at an angle - the hour minute and second hands are made of the text "x Hours", "y Minutes", "z Seconds".

Right click and menu "Exit" to end.

Trying To Make A Simple Clock
hi I am very new to VB and am just trying to make a simple clock to show the system time i found a fiew tutorials online and have it working but it shows the seconds and i am wanting to show hours mins and am or pm

if i just put

Label1.Caption = Time i get everything

is there a way to cut out the seconds for what it shows?


Is There A Way To Make A Count Down Clock In VB?
I want to make a clock that will count down from 30...29...28 etc. this will be for a trivia game that I am making so that the person only has so much time to answer?


How I Make Alarm Clock?
i want make program that play MP3 file at 6:45 AM or such

Know how to do Mp3 understand how make play at certain time! How I do?

Is There A Way To Make An Icon By The Clock On The Taskbar?
Is there a way to make an icon by the clock on the taskbar?

How Do I Make A Visual Basic Clock?
I was planning on making a Visual Basic clock but just didn't know howto.

VB Code:
Private Function Timee()AA = Hour(Now)BB = Minute(Now)CC = Second(Now)MsgBox AA & ":" & BB & ":" & CCEnd Function Private Sub Form_Load()Y = X - 1Do Until X = YX = X + 1TimeeLoopEnd Sub

Oh well there is a start. I want the timer to be on my form no message box or anything though.

Any1 Know How To Make A Simple Clock
I am just wondering if any1 knows how to make a simple clock?

Windows Clock: Make It Wider
I am replacing that ugly default windows clock on the taskbar with my own. Unfortunately, I do not know how to make the clock's area wider. Please see the attachment or visit this link: . As you can see, if you make the clock stay stationary (don't have it scroll with the text), you can't have the text very big or add the date to the left of the clock without the text having to scroll(which is the main thing I want). Does anyone know how to make the clock's area wider?

Forgot the attachment.

Edited by - Marce22 on 8/11/2003 12:03:33 AM

How To Make This Timer Based On The System Clock
Hi everyone,

I have a VB countdown timer application that uses the following code to do the countdown.

But the problem with the countdown is that it doesnt correspond with the sytem clock. I want the code's seconds to correspond with system clock instead of starting from 00 or 59. can anyone please help me.

The code is below:

Private Sub Timer1_Timer()
Timer1.Enabled = False
If (Format$(time, "hh") & ":" & Format$(time, "nn") & ":" & Format$(time, "ss")) <> "00:00:00" Then 'Counter to continue loop until 0
time = DateAdd("s", -1, time)
lbltime.Visible = False
lbltime.Caption = Format$(time, "hh") & ":" & Format$(time, "nn") & ":" & Format$(time, "ss")
lbltime.Visible = True
Timer1.Enabled = True
'Turn off timer, set off alarm, and enable reset.
Timer1.Enabled = False

End If

End Sub

Many thanx in advanced.


Creaing Analogue Dials

I am trying to create a program that uses analogue dials. The problem that I am having is I do not know (nor can I work out ) the code used to create (as in draw) a line that goes around that dial in the same way as in the speedometer in your car does indicating a particular speed.

If anyone could help I would be greatly appreciative. If it is important I am using VB5 (Professional) Version.


Bernard in the UK

Winsock? Analogue To Digital Converter.
Can anybody tell me how to create a link to a website and send and receive continuous streams of data ( not unlike a webcam i guess) In my case I want to send data from an analogue to digital converter. Though not familiar with it yet i suspect winsock would have something to do with the process. I need to know which way to go.

Clock, How Can I Put A Ticking Clock In My Program?
is there any way that i can put a clock.. i already have a digital clock.. a clock made out of numbers.. i want to present it graphically.. you know like the clock with the long hand and the short hand.. any suggestions?

Sun Clock
Hi All-

I am attempting to create a sun clock that shows a flat map with the day and night view. There are several Java Applets that do this but my understanding of job is very limited. Basically what i need is the algorithm that will display the curve for the date and time.


Clock Help
i have a alarm clock(not made by me) but i want to make it look better and i want it to be almost like inbedded(spelling?) in my backgroung. i want to make the back and clock part white and make it transparent...
if anyone could help... i dont know how to make it transparent..
also i want to mount it without a umm not sure what its called but there u can minimize and exit at the top.. mount it i mean by making it so you cant move it from the top right hand side of the screen... if you could me out thanks!

Help Me With My Clock m making a clock.
I have a textbox showing the time running on a timer(timer2).
And my second hand is on a timer(timer1)
What my problems are:

1. when i click start my second hand always starts at 15.
2. How can i synchronize my second hand to the currenct second(i will figure hours and minutes later)

Private Const d_theta = 3.141592654 / 30
Private theta As Single
Private r1 As Single
Private cx1 As Single
Private cy1 As Single

Private Sub Cmd_start_Click()
Timer1.Enabled = True
End Sub

Private Sub Cmd_Stop_Click()
Timer1.Enabled = False
End Sub

Private Sub Form_Load()
Dim dx As Single
Dim dy As Single

dx = Line1.X2 - Line1.X1
dy = Line1.Y2 - Line1.Y1
r1 = Sqr(dx * dx + dy * dy)
cx1 = Line1.X1
cy1 = Line1.Y1
End Sub

Private Sub Timer1_Timer()
theta = theta + d_theta

Line1.X2 = cx1 + Cos(theta) * r1
Line1.Y2 = cy1 + Sin(theta) * r1

End Sub

Private Sub Timer2_Timer()
Text1.Text = Time
End Sub

Help With Clock!
Hi. I was wondering if anyone could help me. This is supposed to be a clock that starts when the form loads. But the hand (line1) appears only for the first second then dissappears, leaving only a dot in the middle. It was an extra activity that my teacher gave me after i finished my other assignments. If anyone could help I would appreciate it!!! BTW this was written in VB6.

Clock Help
i am making a simple charge program. what i need to know is how to get a sort of timestamp for certain actions. for instance if a command button was pressed altering something the time and date on the clock (computers clock) would be added to a new form or somewhere. I would then like to be able to view the times at a later date. I might sound confusing but basically i want to save the time and date of certain actions in which the user will do and i would like to view the time of these actions whenever i need to(need to save them somewhere) thanx any help is appreciated

How can i display the system clock in a label in vb???

Conan Visinko

Presently i am doing a program to trigger an action when the time reaches.

Example, when time : 930 am daily its will trigger some action.

Can i know the way of writing (code) to base on my computer clock?
<something to compare to my clock!>

thank you very much

A Little Help With My Clock
hi again all,
can n e one help me with my litte alarm clock? i am not that far at the moment, i got it to tell the time and when time is input it will beep once can n e one help me by showing me how i can make the beeping sound go longer, or even play a different sound all together?

theres my code so far:

Private Sub Timer_Timer()
lbltime.Caption = Format(Time, "HH:MM:SS")

If txtahour & ":" & txtaminute & ":00" = lbltime.Caption Then Beep

End Sub

thats it, its in a timer, so if n e one can help me, plzzzzzzzzzz do so!?!

Clock In VB6
i need to do 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?

I saw that by the post by by mikeee they had this 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

Here is the original post

Now that code does not work on VB6. What can I do to put it on VB6?

Also, How hard would it be to change a VB6 program to a VB2005 program? I have another program in VB6 that is basically buttons playing sounds using MMControl. How can I convert it to VB6?


I want to put a system clock in my project.It works.The codes is as followed:

Private Sub Timer1_Timer()
Label2.Caption = Time
End Sub

But i find that the "Time",does clashes with the counters that i had used.Is there any other way i can display system clock other than this?

Thanks alot in advance.

Anyone have a code to show a digital clock with maybe the date as well??

Thanks in advance

If there is a way for vb to put the current time on your computer into a listbox please tell me how.

Mac Os X Clock
Attached is a osx style cp;ock application-made with aqua soft iapp controls.

Clock In
Hey there!!!

I've created a punch clock application where the employees punch in and out by swiping a magnetic card when they come in.. the screen is used to tell them there status In or out...but how can I detect if the employees change the clock to punch in or out?

How do i make a clock that i can change time and date??

Using A Clock
Here's what I want to do:

Is there a way I can create an alarm clock on my computer? How would I be able to use the computer's clock in my code? What would it require? Thanks for your responses ahead of time.

can anyone help me with a command to grab the current time from the taskbar?

I Need A Clock
i need a clock that i can make say 6 hours more then what my pc clock says
the reason is i have friends that are in the uk

which is 6 hours ahead of me

any way to config a clock to display his time and my time


is there is a way to insert a clock into a program. I tried to use the Time function as the caption of a label, but it does not count second, it is just a snapshot of the time the problem was changed.


Is there a Freeware ActiveX which displays an analog clock? If so could u please reply with the address.


How do I use the clock for display all the time the program is running? Everytime I run the program it only shows the time that the program starts...


Hi guys.

Is there any chance in vb6 that i could call a clock or something like the
date grid. Need help guys.

Thanks In Advance.


Dear VBGuys,
I want to use a clock (HH:mm:ss) on my form , which woks on real time at run time.
How can I do it?
I think it is very simple.
Thanks every one,

Edited by - BarrosAS on 9/4/2003 7:46:57 AM

Hi, im trying to make an analogue stop-clock, but i have no idea how to do the orientations for it. I just want to click a command button and one hand on the clock face turns for 60 seconds.

Any help is appreciated, thank you

&gt;&gt;&gt; Analogic Clock &lt;&lt;&lt;
Hi, people

I'm just trying to make an analogic clock, but I don't know how to move the hands around it.

I've got 3 lines (Line1..3). I guess I got to leave the X2,Y2 alone and move the X1,Y1, but how can I do it?

I don't know anything about mathematics, well, almost anything.


VBA Clock / Time
I am looking for a clock that pops up similiar to the
Cal.MonthView1.Value when a cell is clicked on in an excel sheet.

VBA And System Clock
I have created a VBA program which runs in Excel. It prints cheques and dates them 2 days after the week ending for the relevant invoices therefore always paying on a monday. When the script runs and the cheques are printed for usually between 10 and 20 companies the system clock adjusts itself back to the same date as the cheques that are printing which then means I have to reset the clock to the current date.

Any ideas how I can prevent the system clock changing during this process?

PS: OS = Windows 98SE

Thanks in advance.


Calculate (F9) Every Second ? Like A Clock
How can i get my workbook to re-calculate every second or even five seconds

can it be done ?

Analog Clock
ive been trying to figure out how to make an analog clock and it driving me crazy. im messing around with sin and cos with some lines and its driving me nuts.

Could someone help me out with how to make numbers 0-59 and 0-23 create a circle?

Clock Component?

Anyone know where the analog clock component is in VB6 (the one that appears when you double click the time in the notification area). which library is it in?

I can't find it anywhere - but I have found the monthview which sits next to it on the same time & date dialog.

Thanks for any help.


Clock Not Ticking.....
For some reason my code below is not working right and I am not sure why. It should count down from 45 minutes and display this in real time to the user but when it runs it just sits at 45 minutes. I don't get it.... I just put a beep in there to hear if its ticking and it is. Why does the display not count down though?

Any clues?


Private Sub RTSReminderTimer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RTSReminderTimer.Tick

' 45 Minute RTS Reminder Timer

Static Dim RTS_Timer As Date

'RTS_Timer = Nothing
RTS_Timer = System.DateTime.Now.AddMinutes(45)

' Run The CountDown
RTS_Display.BackColor = Color.Red

RTS_Display.Text = "RTS Reminder Active" & vbCrLf & DateDiff("n", Now, RTS_Timer) & " Minutes " & (DateDiff("s", Now, RTS_Timer) - (DateDiff("n", Now, RTS_Timer) * 60)) & " Seconds"

If RTS_Timer <= System.DateTime.Now Then

RTS_Timer = Nothing

End If

' If The Clock Reaches 0 For Both Values Then Show RTS Popup
If DateDiff("n", Now, RTS_Timer) = "0" And DateDiff("s", Now, RTS_Timer) = "0" Then


End If

End Sub

Also yes the clock is enabled. Interval is set for 1000.

Clock Adjustible With GMT
How can I make a program that fetches the System time, and then in my program you can like set your GM time and it will add or subtract from the system time to make it show another time.

For instance I want to make a clock that shows Thailand time, so if you're in -5 GMT I want it to know it needs to add 12 hours to the system time to give thai time.

Copyright 2005-08, All rights reserved