举一个例子,我就是想利用Timer1一到时间,就中断netcheck动作
Timer1.Interval = 500Public Sub netcheck()
    For i = 1 to 1000000000000000000
        ……
    Next 
End FunctionPrivate Sub Timer1_Timer()
    break netcheck
End Sub

解决方案 »

  1.   

    这样修改:
    Timer1.Interval = 500
    dim bolExit as boolean
    bolExit=fasle
    Public Sub netcheck()
        For i = 1 to 1000000000000000000
           if bolexit then exit sub
        Next 
    End FunctionPrivate Sub Timer1_Timer()
        bolexit=true
    End Sub
      

  2.   

    Timer1.Interval = 500
    dim blnBreak as boolean
    Public Sub netcheck()
        For i = 1 to 1000000000000000000
           if blnBreak  then  exit for
            ……
        Next 
    End FunctionPrivate Sub Timer1_Timer()
    blnBreak =true
    End Sub  
    *****************************************************************************
    欢迎使用CSDN论坛专用阅读器 : CSDN Reader(附全部源代码) http://feiyun0112.cnblogs.com/
      

  3.   

    我不是这个意思,netcheck里面如果不是循环,就是很多语句,那我如何用timer来中断他?