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

continue to next cell while typing

Is there any way to continue to the next cell when I type the maximum number of allowed characters in a TextBox cell or MaskEdit cell? Thanks.

3 Replies

AD Administrator Syncfusion Team October 17, 2003 09:13 PM UTC

I think you can use CurrentCellChanged to do this for a TextBox.
private void gridControl1_CurrentCellChanged(object sender, System.EventArgs e)
{
	GridCurrentCell cc = this.gridControl1.CurrentCell;
	int len = this.gridControl1[cc.RowIndex, cc.ColIndex].MaxLength;
	if(cc.Renderer.ControlText.Length == len)
	{
		this.gridControl1.CurrentCell.MoveRight(1, false);
	}
}


DM Desis Machino October 22, 2003 05:22 PM UTC

This works great if I am in insert mode, but if the user is in overwrite mode, and the cell already has the max number of chars, this approach will not work. Is there a way to determine the location within the cell the user has typed a key? Or is there a better solution?


AD Administrator Syncfusion Team October 22, 2003 09:20 PM UTC

You can use code like GridTextBoxControl tb = cc.Renderer.Control as GridTextBoxControl; to get the textbox from the currentcell renderer. But, I do not know of a simple way to decide whether you are in the overstrike mode. The TextBox and RichTextBox don't seem to expose such a property. So, I think any solution will require some more coding to handle the particular situations.

Loader.
Up arrow icon