[URGENT] Visual Basic Timer Countdown Start from where it stopped

My code works, but when I click in the Pause Button the Timer will stop but if I click in the Start Button Code The Timer won’t start from where it stopped, it will just go the txtTempo Textbox and pick the number and start from there. So, I created a button to start from where pause stopped but I can’t find a code for it.

Top Code:

 Public Class Form1 Private dtInicial As Date Private Calc As TimeSpan 

Start Button Code:

 If Timer3.Enabled = True Then MessageBox.Show("AVISO! Apenas um cronómetro pode estar ligado!") Timer2.Stop() Else If Timer4.Enabled = True Then MessageBox.Show("AVISO! Apenas um cronómetro pode estar ligado!") Timer2.Stop() Else If Timer5.Enabled = True Then MessageBox.Show("AVISO! Apenas um cronómetro pode estar ligado!") Timer2.Stop() Else dtInicial = Now.AddMinutes(Convert.ToInt32(txtTempo.Text)) Timer2.Enabled = True End If End If End If 

Pause Button Code:

 Timer2.Enabled = False PictureBox13.SendToBack() PictureBox24.BringToFront() 

Reset Button Code:

 Timer2.Enabled = False Timer2.Stop() lblTempoJunta.Text = "00:00" 

Timer Code:

 Calc = dtInicial - Now lblTempoJunta.Text = Format(Convert.ToDateTime(Calc.Duration.ToString), "mm:ss") If lblTempoJunta.Text = "00:00" Then Timer2.Enabled = False Timer2.Stop() End If 

I don’t mind changing all the code if necessary. Please reply as soon as possible, because my deadline is today

EDITED

submitted by /u/RuMiArDeSo
[link] [comments]

Leave a Reply