在Unload事件中把所有Timer的Enabled设为False

解决方案 »

  1.   

    Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
    Timer1.Enabled = False
    Unload Me
    End
    End Sub
      

  2.   

    unload me
    set form = nothing
    end
      

  3.   

    private sub form()
    end
    end
      

  4.   

    Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
    Timer1.Enabled = False
    Unload Me
    End
    End Sub
    ---------------------------------------------------------
    Montaque==Digitalboy==Houyongfeng==Monkey
      

  5.   

    unload me 
    set form=Nothing
      

  6.   

    如果你不闲麻烦可以调用如下语句Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)Unload Me
    Set Timer=Nothing
    Set Form=NothingEnd Sub
      

  7.   

    各位大哥,问题解决不了啊,我不能用END,因为我不想结束程序,大家想想办法吧,拜托!
      

  8.   

    dim obj as objectfor each obj in me
       if typeof obj is timer
           obj.enable=false
       end if
    next obj把上面的代码加到一个函数里,关闭窗体的时候调用就可以。
      

  9.   

    Sub ClearCtl(frm As Form)
       Dim ctl As Control
       Dim CtlName As String
        For Each ctl In frm.Controls
          CtlName = TypeName(ctl)
          If CtlName = "PictureBox" Or CtlName = "TextBox" Then ctl.Visible = False
          If CtlName = "Timer" Then ctl.Enabled = False      
       Next
    End Sub调用它
    其它控件自己再加代码。应该看得明白吧