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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Validate text during editing at each change

Thread ID:





13665 May 5,2004 02:48 PM UTC May 5,2004 10:14 PM UTC WinForms 2
Tags: GridControl
Thomas Kratzer
Asked On May 5, 2004 02:48 PM UTC

Hello, 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 1.problem the event is not called on Del-key pressed. 2.problem the backspace-key inserts a character \b into the GridCurrentCellValidateStringEventArgs.Text, which is not in the resulting CellStyleinfo.Text 3.problem 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

Administrator [Syncfusion]
Replied On May 5, 2004 07:17 PM UTC

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. http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=12073 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).

Thomas Kratzer
Replied On May 5, 2004 10:14 PM UTC

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. Thanks again Thomas


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