Hey guys if theres anyone who can help, i need some advice on this:
I have 3 text boxes where the user can input values of seconds, minutes and hours. I need to find a way to use the timer to output the remaining time in hours left, minutes left and seconds left into the caption bar once activated. This will shut down the PC when the time has expired. Here's useful bits of coding i have at the moment, I'm sure i'm just missing something really simple but its doing my head in!
Code:Private Sub startTimer() intCnt = 0 totTime = 0 rHours = 0 rMins = 0 rSeconds = 0 hours = Val(txtHours) 'gets the bizz mins = Val(txtMins) seconds = Val(txtSecs) Call workTotTime rHours = hours rMins = mins rSeconds = seconds Timer1.Enabled = True End Sub Private Sub workTotTime() 'works it out here totTime = (60 * 60 * hours) + (60 * mins) + seconds End Sub Private Sub Timer1_Timer() frmTimer.Caption = totTime - intCnt & " Seconds Until Shutdown" intCnt = intCnt + 1 If intCnt > totTime Then Timer1.Enabled = False frmTimer.Caption = "Shutting Down" Shell "Shutdown -s -t 00" End If End SubHTML Code:<a href=http://myspace.com/kaykorbisskit><img src=http://www.divshare.com/img/2999859-282.JPG alt=MyProblem Height=720 Width=960></a>![]()




Reply With Quote