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

Cursor position in a textbox cell

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

2 Replies

AD Administrator Syncfusion Team 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;
}


AD Administrator Syncfusion Team September 29, 2004 02:57 PM UTC

That got it. Thanks.

Loader.
Live Chat Icon For mobile
Up arrow icon