| | |
help regarding timer
Please support our VB.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Mar 2008
Posts: 1
Reputation:
Solved Threads: 0
hello everyone i am trying to continue the countdown timer from 1 form to another in VB.NET but it is not working...
I have been able to run countdown timer but not able to continue it in the following pages
plz help me out as this project is very imp for me..
IN form
Timer1.Enabled = False
Label1.Text = "3:00.0"
If Not Timer1.Enabled Then
CountDownStart = Microsoft.VisualBasic.DateAndTime.Timer
Timer1.Enabled = True
Else
Timer1.Enabled = False
Label1.Text = "3:00.0"
Endif
In timer
Dim MinDiff
Dim SecDiff
Dim TenthDiff
Dim TimeDiff
TimeDiff = (1800) - Int((Microsoft.VisualBasic.DateAndTime.Timer - CountDownStart) * 10)
If TimeDiff >= 0 Then
TenthDiff = TimeDiff Mod 10
SecDiff = Int(TimeDiff / 10) Mod 60
MinDiff = Int(TimeDiff / 600)
Label1.Text = Format(MinDiff, "00") & ":" & Format(SecDiff, "00") & "." & Format(TenthDiff, "0")
Else
Label1.Text = "00:00.0"
Timer1.Enabled = False
MsgBox("!!!TIME!!!")
endif
I have been able to run countdown timer but not able to continue it in the following pages
plz help me out as this project is very imp for me..
IN form
Timer1.Enabled = False
Label1.Text = "3:00.0"
If Not Timer1.Enabled Then
CountDownStart = Microsoft.VisualBasic.DateAndTime.Timer
Timer1.Enabled = True
Else
Timer1.Enabled = False
Label1.Text = "3:00.0"
Endif
In timer
Dim MinDiff
Dim SecDiff
Dim TenthDiff
Dim TimeDiff
TimeDiff = (1800) - Int((Microsoft.VisualBasic.DateAndTime.Timer - CountDownStart) * 10)
If TimeDiff >= 0 Then
TenthDiff = TimeDiff Mod 10
SecDiff = Int(TimeDiff / 10) Mod 60
MinDiff = Int(TimeDiff / 600)
Label1.Text = Format(MinDiff, "00") & ":" & Format(SecDiff, "00") & "." & Format(TenthDiff, "0")
Else
Label1.Text = "00:00.0"
Timer1.Enabled = False
MsgBox("!!!TIME!!!")
endif
Last edited by icycool007; Mar 15th, 2008 at 2:54 pm. Reason: providing the code
Here's an example of passing a timer between two forms:
VB.NET Syntax (Toggle Plain Text)
Imports System.Windows.Forms Class Form1 Inherits Form Private _timer As Timer Public Sub New() Me.Text = "Form 1" Dim newForm As New Form2 _timer = New Timer _timer.Interval = 5000 AddHandler _timer.Tick, AddressOf TimerElapsed newForm.MyTimer = _timer newForm.Show() End Sub Private Sub TimerElapsed(ByVal obj As Object, ByVal e As EventArgs) _timer.Stop() MessageBox.Show("Timer elapsed from form 2") Application.Exit() End Sub End Class Class Form2 Inherits Form Private _timer As Timer Public Property MyTimer() As Timer Get Return _timer End Get Set(ByVal value As Timer) _timer = value _timer.Start() End Set End Property Public Sub New() Me.Text = "Form 2" End Sub End Class
I'm here to prove you wrong.
![]() |
Similar Threads
- Visual Basic Timer/Clock/Countdown. (Visual Basic 4 / 5 / 6)
- Text Timer (Visual Basic 4 / 5 / 6)
- Timer Question (Visual Basic 4 / 5 / 6)
Other Threads in the VB.NET Forum
- Previous Thread: Bindingnavigator,Datagridview,textboxes
- Next Thread: [Moving from Listbox to an another]
| Thread Tools | Search this Thread |
.net .net2008 2008 access add advanced application array assignment basic beginner box browser button buttons center click client code combo convert cpu cuesent data database datagrid datagridview datetimepicker designer dissertation dissertations dissertationtopic eclipse editvb.net employees excel exists filter forms function html images isnumericfuntioncall listview map mobile module msaccess mssqlbackend mysql net number open page pan panel pdf picturebox picturebox2 port position print printing printpreview read record regex reuse right-to-left save search serial settings socket sorting sqldatbase sqlserver storedprocedure temp textbox timer timespan transparency txttoxmlconverter usercontol vb vb.net vba vbnet vista visual visualbasic visualbasic.net visualstudio.net web winsock wpf wrapingcode xml year






