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

Cursor position in a textbox cell

Thread ID:





19583 Sep 29,2004 01:49 PM UTC Sep 29,2004 02:57 PM UTC WinForms 2
Tags: GridControl
Gordon Rhea
Asked On September 29, 2004 01:49 PM UTC

I''m using a Grid Control and when the user enters a space I am replacing it with an underscore (_) because we don''t allow spaces. Well when I update the cell in the code it puts the cursor at the begining of the text. Is there some way I can either force it to be at the end of the text or move it after I set the text? Thanks, Gordon

Administrator [Syncfusion]
Replied On September 29, 2004 02:04 PM UTC

I am not sure where you are doing this work, but you can position the cursor in an actively editing gridcell by getting the embedded textbox and using it to set the cursor position. Here is code that should put the cursor at the end of the text. (You can move it where ever you need it to be.)
GridTextBoxControl tb = this.grid.CurrentCell.Renderer.Control as GridTextBoxControl;
if(tb != null)
	tb.SelectionStart = tb.TextLength;
	tb.SelectionLength = 0;

Administrator [Syncfusion]
Replied On September 29, 2004 02:57 PM UTC

That got it. Thanks.


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