在text1的KeyPress事件中加入了锁定键盘的代码,请问怎样才能在我按下另外一个命令按钮(比如说command1)的时候解除锁定?
Private Sub Combo2_KeyPress(KeyAscii As Integer)
KeyAscii = 0
End Sub
-------------------------------------------------------------------------
Private Sub Command1_Click()
..............   这里代码应该怎样写才能解除键盘锁定?
End Sub

解决方案 »

  1.   

    privvate bFlg as booleanPrivate Sub Combo2_KeyPress(KeyAscii As Integer)
    if bflg then KeyAscii = 0
    End SubPrivate Sub Command1_Click()
    bflg=False
    End Sub
      

  2.   

    设一个全局变量,在keypress事件中判断,在command1_click中改变。
      

  3.   

    可以设置一个公用变量。如:
    dim A as booleanprivate sub combo2_keypress(keyascii as integer)
        if A then keyascii=0
    end subprivate sub command1_click()
        a=not a
    end sub
      

  4.   

    同样的
     dim t as boolean
    private sub combo2_keypress(keyascii as integer)
    if t=true then keyascii=0
    end subprivate sub command1_click()
    a=false
    end sub