John_Cena 0 Report post Posted April 7, 2005 Hello guys...I made a program but when i run it i get a debug because i put the wrong timers action i tried to change it but still:Private Sub Form_Load()Let lblTime.Caption = Let Timer1.Enabled = TrueLet Timer2.Enabled = FalseEnd SubCan anybody tell me how to put the timers auction on the second line? Share this post Link to post Share on other sites
Galahad 0 Report post Posted April 7, 2005 Hello guys...I made a program but when i run it i get a debug because i put the wrong timers action i tried to change it but still: Private Sub Form_Load() Let lblTime.Caption = Let Timer1.Enabled = True Let Timer2.Enabled = False End Sub ... OK, first of all, following piece of code Let lblTime.Caption = will produce run-time error... You need to assign some value to Caption, like Let lblTime.Caption = "" ' This will set Caption to empty stringI don't know what you are doing in Timer events, but this is the only error in this piece of code... This has nothing to do with Timer actions, it's just a syntax error... A little tip: You can leave out Let statement, it really has no function anymore. Your code would then look like this: Private Sub Form_Load()lblTime.Caption = ""Timer1.Enabled = TrueTimer2.Enabled = FalseEnd Sub Share this post Link to post Share on other sites
OpaQue 15 Report post Posted April 7, 2005 Thanks for the reply Galahad.. :-)John, Please make the topic names more resonable. They should describe the contents of your post. It helps us to rank at search Engines. Share this post Link to post Share on other sites
John_Cena 0 Report post Posted April 8, 2005 i will I still get the debug. I tried everything but nothingHere is the code:Private Sub Form_Load()lblTime.Caption = ""Timer1.Enabled = TrueTimer2.Enabled = FalseEnd SubPrivate Sub txtStatus_Change()If frmMain.WindowState = 1 ThenLet Timer2.Enabled = TrueElseLet Timer2.Enabled = FalseLet frmMain.Caption = "AdCache Remover"End IfEnd SubPrivate Sub cmdQuit_Click()EndEnd SubPrivate Sub Timer1_Timer()Let lblTime.Caption = Str((lblTime.Caption) + 1)Let lblStatusTime.Caption = Str((lblStatusTime.Caption) + 1)On Error Resume Nextx% = Len(Dir$("c:\Windows\System\AdCache\*.*")) 'If you have a different directory for the AdCache change it.If Err Or x% = 0 Then fileexists = False Else fileexists = TrueIf lblTime.Caption = 1 ThenIf fileexists = True ThenKill ("C:\Windows\System\AdCache\*.*") 'If you have a different directory for the AdCache change it.Let txtStatus.Text = "Deleting AdCache"Let lblTime.Caption = 0ElseLet txtStatus.Text = "Removing"Let lblTime.Caption = 0End IfEnd IfIf lblStatusTime.Caption = 1 ThenLet txtStatus.Text = txtStatus.Text & "."ElseIf lblStatusTime.Caption = 2 ThenLet txtStatus.Text = txtStatus.Text & ".."ElseIf lblStatusTime.Caption = 3 ThenLet txtStatus.Text = txtStatus.Text & "..."ElseIf lblStatusTime.Caption = 4 ThenLet txtStatus.Text = txtStatus.Text & "...."ElseIf lblStatusTime.Caption = 5 ThenLet txtStatus.Text = txtStatus.Text & "....."ElseIf lblStatusTime.Caption = 6 ThenLet txtStatus.Text = txtStatus.Text & "......"ElseIf lblStatusTime.Caption = 7 ThenLet txtStatus.Text = txtStatus.Text & "......."ElseIf lblStatusTime.Caption = 8 ThenLet txtStatus.Text = txtStatus.Text & "........"ElseIf lblStatusTime.Caption = 9 ThenLet txtStatus.Text = txtStatus.Text & "........."ElseIf lblStatusTime.Caption = 10 ThenLet txtStatus.Text = txtStatus.Text & ".........."ElseIf lblStatusTime.Caption = 11 ThenLet txtStatus.Text = txtStatus.Text & "..........."ElseIf lblStatusTime.Caption = 12 ThenLet txtStatus.Text = txtStatus.Text & "............"ElseIf lblStatusTime.Caption = 13 ThenLet txtStatus.Text = txtStatus.Text & "............."ElseIf lblStatusTime.Caption = 14 ThenLet txtStatus.Text = txtStatus.Text & ".............."ElseIf lblStatusTime.Caption = 15 ThenLet txtStatus.Text = txtStatus.Text & "..............."ElseIf lblStatusTime.Caption = 16 ThenLet txtStatus.Text = txtStatus.Text & "................"ElseIf lblStatusTime.Caption = 17 ThenLet txtStatus.Text = txtStatus.Text & "................."ElseIf lblStatusTime.Caption = 18 ThenLet txtStatus.Text = txtStatus.Text & ".................."ElseIf lblStatusTime.Caption = 19 ThenLet txtStatus.Text = txtStatus.Text & "..................."ElseIf lblStatusTime.Caption = 20 ThenLet txtStatus.Text = txtStatus.Text & "...................."ElseIf lblStatusTime.Caption = 21 ThenLet txtStatus.Text = txtStatus.Text & ""Let lblStatusTime.Caption = 0End IfEnd SubPrivate Sub Timer2_Timer()Let lblCaptionTime.Caption = Str((lblCaptionTime.Caption) + 1)If lblCaptionTime.Caption = 2 ThenLet lblCaptionTime.Caption = 0End IfIf lblCaptionTime.Caption = 0 ThenLet frmMain.Caption = "AdCache Remover"ElseIf lblCaptionTime.Caption = 1 ThenLet frmMain.Caption = txtStatus.TextEnd IfEnd Sub Share this post Link to post Share on other sites
Argoth 0 Report post Posted April 8, 2005 I believe that this should work. Couple things I noticed, first you set the caption of you label to "" thus the functions that depended on that value wouldn't work. Next the LET is not necessary and the LONG if...elseif...endif statement was WAY too long, I replaced it with something I think should do the same trick. I might have messed up a few of the controls names.... Private Sub Form_Load()lbltime.Caption = "1"Timer1.Enabled = TrueTimer2.Enabled = FalseEnd SubPrivate Sub txtStatus_Change()If frmmain.WindowState = 1 Then Timer2.Enabled = TrueElse Timer2.Enabled = False frmmain.Caption = "AdCache Remover"End IfEnd SubPrivate Sub cmdQuit_Click()EndEnd SubPrivate Sub Timer1_Timer()lbltime.Caption = Str((lbltime.Caption) + 1)lblstatustime.Caption = Str((lblstatustime.Caption) + 1)On Error Resume Nextx = Len(Dir$("c:\Windows\System\AdCache\*.*")) 'If you have a different directory for the AdCache change it.If Err Or x = 0 Then fileexists = False Else fileexists = TrueIf lbltime.Caption = 1 Then If fileexists = True Then Kill ("C:\Windows\System\AdCache\*.*") 'If you have a different directory for the AdCache change it. txtstatus.Text = "Deleting AdCache" lbltime.Caption = 0 Else txtstatus.Text = "Removing" lblstatustime.Caption = 0 End IfEnd IfIf lblstatustime.Caption = 21 Then txtstatus.Text = txtstatus.Text & "" lbltime.Caption = 0Else txtstatus.Text = String(lblstatustime.Caption, ".")End IfEnd SubPrivate Sub Timer2_Timer()Let lblCaptionTime.Caption = Str((lblCaptionTime.Caption) + 1)If lblCaptionTime.Caption = 2 Then lblCaptionTime.Caption = 0End IfIf lblCaptionTime.Caption = 0 Then frmmain.Caption = "AdCache Remover"ElseIf lblCaptionTime.Caption = 1 Then frmmain.Caption = txtstatus.TextEnd IfEnd Sub If you need help (Or I screwed this up) just ask me, also remember to put you code within the code tags so you aren't docked posting points. The code tags are "[ CODE ]" to start the code section and "[ /CODE ]" to end the code. Without the spaces and quotes of course... Share this post Link to post Share on other sites
John_Cena 0 Report post Posted April 8, 2005 I get a debug on this: lbltime.Caption = "1" Share this post Link to post Share on other sites
Galahad 0 Report post Posted April 8, 2005 It would help us if you tell us what specific error you get... If you get an error at that line, I guess you don't have Label object with that name. Maybe you spelled it differently or something... Try to be more descriptive in your posts, we will be able to help you quicker Share this post Link to post Share on other sites
ARNEL 0 Report post Posted June 29, 2005 i will I still get the debug. I tried everything but nothing Here is the code: Private Sub Form_Load() lblTime.Caption = "" Timer1.Enabled = True Timer2.Enabled = False End Sub Private Sub txtStatus_Change() If frmMain.WindowState = 1 Then Let Timer2.Enabled = True Else Let Timer2.Enabled = False Let frmMain.Caption = "AdCache Remover" End If End Sub Private Sub cmdQuit_Click() End End Sub Private Sub Timer1_Timer() Let lblTime.Caption = Str((lblTime.Caption) + 1) Let lblStatusTime.Caption = Str((lblStatusTime.Caption) + 1) On Error Resume Next x% = Len(Dir$("c:\Windows\System\AdCache\*.*")) 'If you have a different directory for the AdCache change it. If Err Or x% = 0 Then fileexists = False Else fileexists = True If lblTime.Caption = 1 Then If fileexists = True Then Kill ("C:\Windows\System\AdCache\*.*") 'If you have a different directory for the AdCache change it. Let txtStatus.Text = "Deleting AdCache" Let lblTime.Caption = 0 Else Let txtStatus.Text = "Removing" Let lblTime.Caption = 0 End If End If If lblStatusTime.Caption = 1 Then Let txtStatus.Text = txtStatus.Text & "." ElseIf lblStatusTime.Caption = 2 Then Let txtStatus.Text = txtStatus.Text & ".." ElseIf lblStatusTime.Caption = 3 Then Let txtStatus.Text = txtStatus.Text & "..." ElseIf lblStatusTime.Caption = 4 Then Let txtStatus.Text = txtStatus.Text & "...." ElseIf lblStatusTime.Caption = 5 Then Let txtStatus.Text = txtStatus.Text & "....." ElseIf lblStatusTime.Caption = 6 Then Let txtStatus.Text = txtStatus.Text & "......" ElseIf lblStatusTime.Caption = 7 Then Let txtStatus.Text = txtStatus.Text & "......." ElseIf lblStatusTime.Caption = 8 Then Let txtStatus.Text = txtStatus.Text & "........" ElseIf lblStatusTime.Caption = 9 Then Let txtStatus.Text = txtStatus.Text & "........." ElseIf lblStatusTime.Caption = 10 Then Let txtStatus.Text = txtStatus.Text & ".........." ElseIf lblStatusTime.Caption = 11 Then Let txtStatus.Text = txtStatus.Text & "..........." ElseIf lblStatusTime.Caption = 12 Then Let txtStatus.Text = txtStatus.Text & "............" ElseIf lblStatusTime.Caption = 13 Then Let txtStatus.Text = txtStatus.Text & "............." ElseIf lblStatusTime.Caption = 14 Then Let txtStatus.Text = txtStatus.Text & ".............." ElseIf lblStatusTime.Caption = 15 Then Let txtStatus.Text = txtStatus.Text & "..............." ElseIf lblStatusTime.Caption = 16 Then Let txtStatus.Text = txtStatus.Text & "................" ElseIf lblStatusTime.Caption = 17 Then Let txtStatus.Text = txtStatus.Text & "................." ElseIf lblStatusTime.Caption = 18 Then Let txtStatus.Text = txtStatus.Text & ".................." ElseIf lblStatusTime.Caption = 19 Then Let txtStatus.Text = txtStatus.Text & "..................." ElseIf lblStatusTime.Caption = 20 Then Let txtStatus.Text = txtStatus.Text & "...................." ElseIf lblStatusTime.Caption = 21 Then Let txtStatus.Text = txtStatus.Text & "" Let lblStatusTime.Caption = 0 End If End Sub Private Sub Timer2_Timer() Let lblCaptionTime.Caption = Str((lblCaptionTime.Caption) + 1) If lblCaptionTime.Caption = 2 Then Let lblCaptionTime.Caption = 0 End If If lblCaptionTime.Caption = 0 Then Let frmMain.Caption = "AdCache Remover" ElseIf lblCaptionTime.Caption = 1 Then Let frmMain.Caption = txtStatus.Text End If End Sub 69598[/snapback] John_cena just try to check your code under Timer1 function... and also when you do coding you can indent each block of codes for you to be able to trace easily the code especially those syntax error. your code are almost done it just a miss matched of using "IF" and "END IF" command... Share this post Link to post Share on other sites