How to provide tab key support when the form contains different controls along with the GridGroupingControl?
Description:
When
you press the tab key in the Grid control, it
moves the focus to the next cell, by
default. To change the behavior of the tab key
to navigate to the next control, the following can be
done:
Solution:
1.WantTabKey property:
By setting the WantTabKey property
value to false, the
focus can be moved to the next control. It
disables the tab option in the Grid.
C#
//By using the WantTabKey property.
this.gridGroupingControl1.WantTabKey = false;VB
'By using the WantTabKey property.
Me.gridGroupingControl1.WantTabKey = FalseTo move the
focus to the next control by using the tab key while
the Grid is currently focused, use the CurrentCellKeyDown event.
C#
//Hooks the event to move the focus to the next control while pressing the tab key.
this.gridGroupingControl1.TableControl.CurrentCellKeyDown +=TableControl_CurrentCellKeyDown;
void TableControl_CurrentCellKeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Tab)
{
//Changes the selection to the next control of the form.
this.gridGroupingControl1.Parent.SelectNextControl(gridGroupingControl1, true, true, false, false); ;
}
}' Hooks the event to move the focus to the next control while pressing the Tab key
AddHandler Me.gridGroupingControl1.TableControl.CurrentCellKeyDown, AddressOf TableControl_CurrentCellKeyDown
Private Sub TableControl_CurrentCellKeyDown(sender As Object, e As KeyEventArgs)
If e.KeyCode = Keys.Tab Then
' Changes the selection to the next control of the form
Me.gridGroupingControl1.Parent.SelectNextControl(gridGroupingControl1, True, True, False, False)
End If
End Sub