这段代码放在什么地方,如果在事件中或其他函数过程中这样改:

Dim count As Integer
count = 0
改为
Static count as Integer

解决方案 »

  1.   

    这段代码放到单击事件中
    count在窗体级上定义与赋值,单击事件中不赋值,只做累加
    me.hide改成unload me
      

  2.   

    你的变量count是local变量,每次调用这个sub时它就被初始化为0。
    可以用全局变量
    e.g, pubic g_intCount as integerprivate sub test()
      if condition=true then
        g_intCount = g_intCount +1
      end if  if g_intCount = 3 then
      'do some thing here  end if
    end sub