0

我有一个程序可以更改数据库中的值。我的表单中有一个 TrueDBGrid,Page Down/Up 工作正常。如果我单击带有 TAB 的按钮,则此 Page Down/Up 仍然有效。当焦点在按钮上时,如何防止这种情况发生?

4

1 回答 1

0

我找到了解决方案。那将是:

Private Sub frmZeitcodeListe_KeyDown(sender As Object, e As KeyEventArgs) Handles MyBase.KeyDown
    Try

        If e.KeyCode = Keys.PageUp Then
            If cmdBearbeiten.Focused = True Or cmdLoeschen.Focused = True Or cmdNeu.Focused = True Or cmdSchliessen.Focused = True Then
                e.Handled = False
            Else
                bsTblZeitcode.MovePrevious()
                e.Handled = True
            End If

        ElseIf e.KeyCode = Keys.PageDown Then
            If cmdBearbeiten.Focused = True Or cmdLoeschen.Focused = True Or cmdNeu.Focused = True Or cmdSchliessen.Focused = True Then
                e.Handled = False
            Else
                bsTblZeitcode.MoveNext()
                e.Handled = True
            End If
        End If

    Catch ex As Exception
    End Try
End Sub
于 2019-10-22T08:43:19.750 回答