Tommyworker
2020-10-02T09:59:47Z
Hello together,
i have more then on grid on my form, also other objects.
how can i tab through all my bottons and grids ?
if i'm in the grid i can tab in the row throug the cells (fine) which key combination i have to use
to tab from the last cell of the first Grid to the next Grid? I use the grids with xCols an one header and row.
Regards Thomas
Igor/10Tec
2020-10-05T15:05:24Z
There is no such a built-in key or key combination. I think you should process a KeyDown event: analyze whether the current cell is the last cell in the grid, and if so, cancel the key press and switch the input focus programmatically to the next grid.
Tommyworker
2020-10-06T06:27:15Z
Hello Igor, thank you help me much in the last years.
my little "jour fix" snippet
Regard Thomas

''' Declaration 2 classes
Private Property Eor As Boolean

Public Class clsTabFocus
        ' set it to object let us use every kind of object to set the focus to it
        Public Property FocusFrom As Object
        Public Property FocusTo As Object
        Public Sub New()
            With Me
                .FocusFrom = Nothing
                .FocusTo = Nothing
            End With
        End Sub
    End Class

 Public Class clsTabFocusList
        Public Property TabFocusList As List(Of clsTabFocus)
        Public Sub New()
            With Me
                .TabFocusList = New List(Of clsTabFocus)
            End With
        End Sub
        Public Function WhosNext(ByVal y As iGrid) As iGrid
            For Each x As clsTabFocus In TabFocusList
                If x.FocusFrom.name.ToString.ToLower = y.Name.ToLower Then
                    Return x.FocusTo
                    Exit Function
                End If
            Next
        End Function
    End Class
''' Constructor
    Public TFL As New clsTabFocusList
''' Form loading

  TFL.TabFocusList.Add(New clsTabFocus With {.FocusFrom = IGrid2, .FocusTo = IGrid3})
  TFL.TabFocusList.Add(New clsTabFocus With {.FocusFrom = IGrid3, .FocusTo = IGrid2})

''' 
 Public Sub KeyDownEndOfRow(sender As Object, e As KeyEventArgs) Handles IGrid2.KeyDown, IGrid3.KeyDown
        Debug.Print("Focus Next: " & e.KeyCode)
        If (sender.CurCell.ColIndex = sender.Cols.Count - 1 And e.KeyCode = Keys.Tab) Or (sender.CurCell.ColIndex = sender.Cols.Count - 1 And e.KeyCode = Keys.Left) Then
            Eor = True
            Debug.Print("FocusNext KeyPress: Spalte: " & e.KeyCode.ToString)
        End If
    End Sub

    Public Sub KeyPressEndOfRow(sender As Object, e As KeyPressEventArgs) Handles IGrid2.KeyPress, IGrid3.KeyPress
        If Eor = True Then
            Debug.Print("KeyPress KeyChar: " & e.KeyChar.ToString)
            TFL.WhosNext(sender).Focus()
            TFL.WhosNext(sender).Cells(0, 0).Selected = True
            Eor = False
            e.Handled = True
        End If
    End Sub