请问在程序中如何实现F1的响应?

解决方案 »

  1.   

    form_keypress()
        if keyascii=VBF1 then
              form1.show
        endif
    end sub
    vbf1是指F1的代码
      

  2.   

    Option ExplicitPrivate Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = vbKeyF1 Then MsgBox "你按下的F1"
    End SubPrivate Sub Form_Load()
    Me.KeyPreview = True
    End Sub
      

  3.   

    KeyPreview为True是说在程序中按任意键首先由Form接收,这样可以在Form的键盘事件中拦截。diyee(锦衣夜行)说的也是个办法,不过如果程序中做了菜单且菜单设为F1的话就不行了。