The Code I Posted will work, all you have to do is save/set the value of tInterval, eg.
------------------Code:Private tInterval As Long 'Interval in Minutes Private Sub Timer1_Timer() Static tTimer As Single Dim lSecs As Long Dim iMins As Integer Dim iHrs As Integer If tTimer = 0 Then tTimer = Timer If (Timer - tTimer) >= (tInterval * 60) Then 'ShutDown the Computer Timer1.Enabled = False End If lSecs = (tInterval * 60) - Int(Timer - tTimer) iHrs = Int((lSecs / 60) / 60) iMins = Int((lSecs / 60) - (iHrs * 60)) lSecs = (lSecs - (iMins * 60) - (iHrs * 360)) Mod 60 Caption = "Shutdown in " & _ Right("00" & iHrs, 2) & ":" & Right("00" & iMins, 2) & ":" & Right("00" & lSecs, 2) End Sub Private Sub Form_Load() 'Get the Stored Time Interval, Default to 1 Hour (60 Mins). tInterval = Val(GetSetting(App.Title, "Interval", "Value", "60")) If MsgBox("Do You Wish to Change the Time Interval?" & _ vbCrLf & vbCrLf & _ "It is Currently.. " & tInterval & _ " Minutes.", vbQuestion + vbYesNo, "Timer Interval") = vbYes Then tInterval = Val(InputBox("Enter a new Interval in Minutes: ", "Set Interval", _ tInterval)) End If 'Save the Interval to the Registry SaveSetting App.Title, "Interval", "Value", Trim(Str(tInterval)) Timer1.Interval = 100 End Sub
Aaron Young
Analyst Programmer
[email protected]
[email protected]




Reply With Quote