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

Manually setting cursor/caret postion.

Thread ID:





17291 Aug 5,2004 09:00 AM UTC Aug 5,2004 09:30 AM UTC WinForms 1
Tags: GridControl
Asked On August 5, 2004 09:00 AM UTC

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 09:30 AM UTC

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.

Please sign in to access our forum

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

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
Live Chat Icon