We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to move the cursor position to the end of the text in WinForms GridGroupingControl?

Platform: WinForms |
Control: GridGroupingControl
Tags: moving, cursor

Move the cursor position

To set the record with cursor at end position while moving the cursor dynamically, you can use the CurrentCell.MoveTo method. After moving the CurrentCell to particular cell, you can set the cursor at end position by using CurrentCell.Renderer.

If you want to highlight the cellvalue in cell, you can use renderer.TextBox.SelectAll()method instead of using renderer.TextBox.SelectionStart. 


private void moveBtn_Click(object sender, EventArgs e)
    //Set your needed column index
    int colIndex = this.gridGroupingControl1.TableDescriptor.FieldToColIndex(0);
    //Getting the record rowIndex based on its position
    int rowIndex = this.gridGroupingControl1.Table.Records[0].GetRowIndex();
    //Moving the current cell
    this.gridGroupingControl1.TableControl.CurrentCell.MoveTo(rowIndex, colIndex, Syncfusion.Windows.Forms.Grid.GridSetCurrentCellOptions.SetFocus);           
    //Setting the cursor at end position of cell
    if (this.gridGroupingControl1.TableControl.CurrentCell.Renderer is GridTextBoxCellRenderer)
        GridTextBoxCellRenderer renderer = this.gridGroupingControl1.TableControl.CurrentCell.Renderer as GridTextBoxCellRenderer;
        renderer.TextBox.SelectionStart = renderer.TextBox.Text.Length;



Private Sub moveBtn_Click(ByVal sender As Object, ByVal e As EventArgs)
     'Set your needed column index
     Dim colIndex As Integer = Me.gridGroupingControl1.TableDescriptor.FieldToColIndex(0)
     'Getting the record rowIndex based on its position
     Dim rowIndex As Integer = Me.gridGroupingControl1.Table.Records(0).GetRowIndex()
     'Moving the current cell
     Me.gridGroupingControl1.TableControl.CurrentCell.MoveTo(rowIndex, colIndex,  Syncfusion.Windows.Forms.Grid.GridSetCurrentCellOptions.SetFocus)
     'Setting the cursor at end position of cell
     If TypeOf Me.gridGroupingControl1.TableControl.CurrentCell.Renderer Is   GridTextBoxCellRenderer Then
        Dim renderer As GridTextBoxCellRenderer = TryCast(Me.gridGroupingControl1.TableControl.CurrentCell.Renderer, GridTextBoxCellRenderer)
        renderer.TextBox.SelectionStart = renderer.TextBox.Text.Length
     End If
End Sub


In the below sample, we have provided the two buttons. If you press the “Moving with cursor at end” button, the currentcell will be moved to particular cell with cursor at end position. The currentcell will be moved with highlighting the cellvalue if you press the “Moving with CellValue highlighting” button.




Show the cursor position in GridGroupingControl

Show the cursor position in GridGroupingControl


2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile