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)
DMDesis MachinoOctober 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?
AdministratorOctober 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.