Articles in this section
Category / Section

How to provide tab key support when the form contains different controls along with the GridGroupingControl?

2 mins read

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 = False

 

  1. CurrentCellKeyDown Event:

To 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); ;
    }
}

 

VB

'Hooks the event to move the focus to the next control while pressing the tab key.
Me.gridGroupingControl1.TableControl.CurrentCellKeyDown +=TableControl_CurrentCellKeyDown
Private Sub TableControl_CurrentCellKeyDown(ByVal sender As Object, ByVal 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

Sample Links:

C#: TabKeyInGGC

VB: TabKeyInGGC

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied