private sub cmd_Click()
    static i as long
    select case i
       case 0
           '事件1
       case 1
           '事件2
    end select
    i=i+1
    if i=2 then i=0
end sub

解决方案 »

  1.   

    Private Sub Command1_Click()
        Static i As Long
        i = i + 1
        MsgBox "第" & i & "次"
    End Sub
      

  2.   

    用checkbox
    把style改成图形的
    然后在你按得时候根据 checkbox 的   value来判断
      

  3.   

    Dim i As IntegerPrivate Sub Command1_Click()
        i = i + 1
        Print "第" & i & "次"
    End Sub
      

  4.   

    Dim flag as boolPrivate Sub Command_Click()if flag=true then
    事件1
    flag=false
    End ifif flag=false then
    事件2
    End ifEnd sub
      

  5.   

    Dim flag as boolPrivate Sub Command_Click()if flag=true then
    事件1
    flag=false
    End ifif flag=false then
    事件2
    flag=true
    End ifEnd sub
      

  6.   

    Dim i As IntegerPrivate Sub Command1_Click()
        i = i + 1
        If i = 3 Then i = 1
        Print "第" & i & "次"
    End Sub
    ''''''''''''''''''''''''''''''''''
    Dim i As BooleanPrivate Sub Command1_Click()
        If i Then
            Print "第 2 次"
            i = False
        Else
            Print "第 1 次"
            i = True
        End If
    End Sub
      

  7.   

    dim i as integer 'i为全局变量
        
    Private Sub Command1_Click()
        select case i
           case 0
               '事件1
           case 1
               '事件2
        end select
        i = i + 1
    End Sub 
     
      

  8.   

    Dim i As IntegerPrivate Sub Command1_Click()
        i = i + 1
        Print "第" & i & "次"
    End Sub
      

  9.   

    Static i As Long
    请教Static 有什么作用?
      

  10.   

    可以衣据按钮的"caption"来作判断运行哪此代码
      

  11.   

    Static 是静态变量,只在程序启动时初始化一次!