VB6 Wrong Events fires on F5

170 Views Asked by At

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

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

When I press F3 on the grid I get the right event

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

Any ideas?

1

There are 1 best solutions below

0
On

It seems that you are trying to handle the _KeyUp function in two different functions. 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:

     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.