I work with version 2.0 and use the GridControl class.
I would like to validate text during editing in a cell in a way that I don''t want to reject wrong input, but to diplay some error text in a separate textbox outside of the grid. I want to do this on each key which is pressed.
I do that now by the event CurrentCellValidateString and use the string of GridCurrentCellValidateStringEventArgs.Text
the event is not called on Del-key pressed.
the backspace-key inserts a character \b into the GridCurrentCellValidateStringEventArgs.Text, which is not in the resulting CellStyleinfo.Text
during that event when I try to change the Text Color of the CurrentCell the focus jumps to the begining and the inserted character is inserted at the beginning and not where the focus was during typing the key.
thanks for help
ADAdministrator Syncfusion Team May 5, 2004 03:17 PM
These are some problems we will try to address in a future release. (Do not know exactly what release will have these fixed.)
Here is a forum thread on similar questions and it has a sample trying to work-around such problems through some events.
To try to have the cursor in the same position before and after resetting the backcolor on an active cell will likely require that you save the textbox.SelectionStart and textbox.SelectionsLength before the change and restore them after the change. The sample in the above forum thread has similar code (for a different reason though).
TKThomas KratzerMay 5, 2004 06:14 PM
Thanks for the quick answer. It works!!
I only had to use the GridTextBoxControl.TextChanged event of your example, because I don''t prevent the user of typing something wrong. I get the text there and I set the textcolor of GridControl.CurrentCell.. to red. I don''t have the focus jumping problem now without doing anything special about it.