简体   繁体   English

VB6 错误事件在 F5 上触发

[英]VB6 Wrong Events fires on F5

I have a grid on a user control, which is on a user document vbd page, which is in ActiveX exe Application This is the event I get when pressing F5 on the grid我在用户控件上有一个网格,它在用户文档 vbd 页面上,在 ActiveX exe 应用程序中 这是我在网格上按 F5 时得到的事件

   Private Sub mnuRightClickRefresh_Click()
       'Call ...
   End Sub

When I press F3 on the grid I get the right event当我在网格上按 F3 时,我得到了正确的事件

   Private Sub grdObjects_KeyUp(KeyCode As Integer, Shift As Integer)
       If KeyCode = 116 Then
        '...
       End If
   End Sub

Any ideas?有任何想法吗?

It seems that you are trying to handle the _KeyUp function in two different functions.您似乎正在尝试在两个不同的函数中处理 _KeyUp function。 When you Press F5, make sure that no control has any focus (thus making the form it self as the focused control) then you may handle the event in the following way:当您按 F5 时,请确保没有任何控件具有任何焦点(从而使表单本身成为焦点控件),然后您可以通过以下方式处理事件:

     Private Sub grdObjects_KeyUp(KeyCode As Integer, Shift As Integer)
         Select Case KeyCode
              Case 116
                'Do Whatever F3 would want to do
              Case 118
                 'Do F5 Stuff
              Case 119
                  'Any other stuff for F6
          End Select
   End Sub

Let me know if this is what you wanted.让我知道这是否是你想要的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM