private sub timer1_timer()   if xxxx then xxxxx   if xxxx then xxxxx
   
end subtimer控件会不停的循环 这2个IF语句
我现在遇到的问题是如果第2个IF语句运行完了以后,间隔时间到了,下次再运行的时候将不运行第2条IF语句该怎么写?

解决方案 »

  1.   

    你可以设置一个计数变量 i=1
    private sub timer1_timer()
       dim i as integer
       i=1
       if xxxx then xxxxx   if xxxx and i=1 then xxxxx
          i=i-1
       
    end sub
      

  2.   

    dim Pause as boolean
    private sub timer1_timer()
       if xxxx then xxxxx
       if Not Pause then if xxxx then xxxxx
       Pause=true
       
    end sub
      

  3.   

    设置一个static变量,保存标志就可以了。
      

  4.   

    private sub timer1_timer()
       static Pause as boolean
       if xxxx then xxxxx
       if Not Pause then if xxxx then xxxxx
       Pause=true
       
    end sub