Home Forums WinForms controls Xceed Grid for WinForms Validating cell input

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #12962 |

    I have an unbound grid that I am allowing the user to input data into just 1 column. I want to validate the input as it is being entered and I have managed to use the LeavingEdit event of the Cell to do this. However, I am unable to prevent the user from moving away from the cell when the contents are not valid. I can display a message but the selection moves to the new location regardless of whether the input is valid or not. The best I am able to do is cancel the edit and revert the cells contents back to its previous value which is not very user-friendly.

    How can I stop the current selection from moving when my validation routine identifies that the contents are invalid?

    Imported from legacy forums. Posted by TechnoTone (had 2088 views)

    User (Old forums)
    Member
    Post count: 23064

    Found the solution – thanks to <a href=”http://www.xceedsoft.com/Forums/ShowPost.aspx?PostID=679″>this thread</a>.

    In the cells LeavingEdit event I need to set e.Cancel = True and in the cells ValidationError event I need to set e.CancelEdit = False.

    Imported from legacy forums. Posted by TechnoTone (had 3095 views)

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.