I am try to create a couter that will show seconds and minutes. I need the counter to start at 0 seconds and 0 minutes. I made a label to display the the counter and named it Label1. I also have the timer object called Timer1. I think I might have got the timer to count but it did show up in the label. I told the timer to display in Label1 and made sure that Label1 was visible but it still doesn't work.

Below is my code that I've entered. If someone could please help me, it would be greatly appresiated. I really need this to work.

Public Class Form1
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim counter As Decimal
counter = 0.0
If Label1.Text = "" Then
Timer1.Enabled = True
Do
counter = counter + 1
Loop While counter > 0
Label1.Text = counter
Else
Label1.Text = "Done"
End If
End Sub
Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click
Label1.Visible = True
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Timer1.Interval = 1000
Label1.Text = ""
End Sub
End Class

Hi Knight_Blazer,


Do you have a stopwatch available? I'm a .net and greater guy, so lack experience with 6.0, but think the stopwatch control would be a bit better for you.

Let me know and I'll help you fix your code when I get home.

Jon

hi.. first ithink its not right to put a loop insidde a counter because the timer is already like a loop thats why theres an interval declare for it to work .. i saw that you put 1000 in interval, so i guess u mean every minute it should trigger... so inside the timer just put sothing like this..

label1.caption = now - starttime

declare starttime as "public long" then give a value into it in form load or in the trigger of your timer if theres one..

i hope you get the idea..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.