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.

Manually setting cursor/caret postion.

Thread ID:





17291 Aug 5,2004 05:00 AM Aug 5,2004 05:30 AM Windows Forms 1
Tags: GridControl
Asked On August 5, 2004 05:00 AM

Hi I''ve got a problem where I am manually calling .BeginEdit on a cell to get it into edit mode, but I need to specify where the user starts typing within the cell text by specifying the caret position. Any ideas how I can go about this? Thanks Martin

Administrator [Syncfusion]
Replied On August 5, 2004 05:30 AM

One way you can do this is to get the renderer for the currentcell, and then if it is a textbox, set the SelectionStart and Selection.Len. Here is a snippet that positions the cursor at the end of the text in CurrentCellStartEditing.
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;


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.