I don't get this at all! I'm making a program that "Locks" windows for a defined period of time. I have 3 settings. Setting 1 is to lockdown for a certain ammount of time. Setting 2 is to lock permanently. Setting 3 is to restart once the timer is completed. That's where the problem is! In setting 3's Subroutine...
Heres a fragment of the code...
The settings are represented by timers (e.g. setting 1 is timer1 and so on)VB Code:
Private Sub Timer1_Timer() BlockInput True If lbltime.Caption > 0 Then lbltime.Caption = lbltime.Caption - 1 Else lbltime.Enabled = False BlockInput False Sleep 800 Unload frmLocked Unload frmWinLock Timer1.Enabled = False End End If End Sub Private Sub Timer2_Timer() BlockInput True lbltime.Caption = "++++" If lbltime.ForeColor = &H80000012 Then lbltime.ForeColor = &HE0E0E0 Else lbltime.ForeColor = &H80000012 End If End Sub Private Sub Timer3_Timer() BlockInput True If lbltime.Caption > 0 Then lbltime.Caption = lbltime.Caption - 1 Else lbltime.Enabled = False BlockInput False Sleep 800 Unload frmLocked Unload frmWinLock Timer1.Enabled = False End End If End Sub
Whenver I run the program on setting 3 I get this error message "Runtime Error Type 13, Type Mismatch" on the "If lbltime.Caption > 0 Then" line on timer3. However, as you may see above, the code for timer1 and timer3 are the same. I know that timer3 won't restart windows cauz I havent augmented its code yet. But VB only gets the error on timer3...whats going on?!
Note: lbltime.caption is set by a variable "seconds", "seconds" is a public integer.




Reply With Quote