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

Caret position when entering edit mode

When I have entered text in a cell and press F2, the cells enters in editing mode, but the caret is at the beginning of the text. How can I send the caret to the end of the text? Thanks.

3 Replies

AD Administrator Syncfusion Team November 8, 2002 12:36 PM UTC

One way you can do this is to handle the CurrentCellStartEditing event and explicitly set the cursor position in the textbox.
private void gridControl1_CurrentCellStartEditing(object sender, System.ComponentModel.CancelEventArgs e)
	GridTextBoxCellRenderer tbr = this.gridControl1.CurrentCell.Renderer as GridTextBoxCellRenderer;
	if(tbr != null)
		tbr.TextBox.SelectionStart = tbr.TextBox.Text.Length;
		tbr.TextBox.SelectionLength = 0;

CN Clinton Nielsen September 8, 2005 04:40 PM UTC

I have a related problem. What I need is for when the user clicks on the cell, the caret position is in the text at the same place where the user clicked. How would I go about doing this? thx.

AD Administrator Syncfusion Team September 8, 2005 06:48 PM UTC

Try setting this property to see if it gives you what you want. this.grid.ActivateCurrentCellBehavior = GridCellActivateAction.PositionCaret

Live Chat Icon For mobile
Up arrow icon