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.
Unfortunately, activation email could not send to your email. Please try again.

Caret position when entering edit mode

Thread ID:





1532 Nov 8,2002 06:36 AM Sep 8,2005 02:48 PM Windows Forms 3
Tags: GridControl
Teodorico Morell
Asked On November 8, 2002 06:36 AM

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.

Administrator [Syncfusion]
Replied On November 8, 2002 07:36 AM

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;

Clinton Nielsen
Replied On September 8, 2005 12:40 PM

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.

Administrator [Syncfusion]
Replied On September 8, 2005 02:48 PM

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


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

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.