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 select all the text on clicking the cell in WinForms GridControl?

Platform: WinForms |
Control: GridControl
Tags: selection


In GridControl, the current cells behavior is controlled by the grid’s ActivateCurrentCellBehavior property. When the property is set to SelectAll, it selects all the text in the cell when the cell becomes the current cell.


//set to select all the text in the current cell
this.gridControl1.ActivateCurrentCellBehavior = Syncfusion.Windows.Forms.Grid.GridCellActivateAction.SelectAll;



'set to select all the text in the current cell
Me.gridControl1.ActivateCurrentCellBehavior = Syncfusion.Windows.Forms.Grid.GridCellActivateAction.SelectAll

After applying the properties, the grid is shown as follows,

Select the text in the cell

Figure 1: Selects all the text in the cell


C#: SelectAll Text

VB: SelectAll Text

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
You must log in to leave a comment
Adam Bruss
Aug 17, 2016
How can I select all the text in a cell when the user is editing a cell and presses Ctrl+A? Reply
Neelakandan Kannan [Syncfusion]
Aug 19, 2016

Hi Adam,


Thanks for using Syncfusion products.





Select all the text in a cell when the user is editing a cell and presses Ctrl+A



Solution - 1

The reported scenario can be achieved by setting the CellType as OriginalTextBox. Please make use of below code,


Code snippet

this.gridControl1.TableStyle.CellType = GridCellTypeName.OriginalTextBox;




Solution – 2

You can also handle the CurrentCellKeyDown event to achieve the reported scenario. Please make use of below code,


Code snippet


this.gridControl1.CurrentCellKeyPress += new KeyPressEventHandler(gridControl1_CurrentCellKeyPress);



void gridControl1_CurrentCellKeyPress(object sender, KeyPressEventArgs e)


    if (((Control.ModifierKeys & Keys.Control) != Keys.None) && char.IsLetter('A'))


        if (this.gridControl1.CurrentCell.IsEditing)


            GridTextBoxCellRenderer renderer = this.gridControl1.CurrentCell.Renderer as GridTextBoxCellRenderer;











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