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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Validating data

Thread ID:





3854 Apr 14,2003 11:17 AM UTC Apr 15,2003 09:38 AM UTC WinForms 4
Tags: GridControl
Administrator [Syncfusion]
Asked On April 14, 2003 11:17 AM UTC

I'm trying to validate a users input in a Grid. Using the CurrentCellValidating event, I'm able to validate wheter or not the data i correct. If not, I show a message-box, and started out setting the CancelEventArgs's Cancel-property to true... But then my message-box showed up twice!!?? Then I tried setting a private variable to true if there where an error and checked for this variable's value when the CurrentCellAcceptedChanges event is fired. If the private variable is true, I set the CancenEventArgs of CurrentCellAcceptedChanges to true and it almost works fine... (my message-box is only shown once) The only problem is, that after the message-box is shown and the edited cell gets focus the user can simply just hit the Enter-key og an arrow-key and then the value is validated... How can I fix this? Kenneth

Administrator [Syncfusion]
Replied On April 14, 2003 01:09 PM UTC

That should be no problem to show a message box and then set e.Cancel = true. Is it just a message box you show (with MessageBox.Show) or maybe another dialog that maybe causes Validation to be triggered once again on the parent form? Are you also setting CurrentCell.ErrorMessage? Stefan

Administrator [Syncfusion]
Replied On April 15, 2003 03:55 AM UTC

No I'm not setting any CurrentCell.ErrorMessage... Attached is some of my code. I've implemented my own version of the GridControl (EaGridControl.cs), because I'd like the user to be able to hit the Enter-key and then move from one enabled cell to the next (even if this in the next row)... Maybe there's a better way to do this? Anyway, I've also included some of the code, from the form, that uses EaControlGrid - I hope this helps!

Administrator [Syncfusion]
Replied On April 15, 2003 08:51 AM UTC

There is a property setting that you can use to cause the grid to wrap the row and move right on Enter.
this.gridControl1.Model.Options.WrapCellBehavior = GridWrapCellBehavior.WrapRow;

this.gridControl1.EnterKeyBehavior = GridDirectionType.Right;
Attached is a sample that uses these properties and does validation in CurrentCellAcceptedChanges without the double message.

Administrator [Syncfusion]
Replied On April 15, 2003 09:38 AM UTC

Man did I just waste a lot of time figuring that out! Great job, Clay! Thanks for the quick response!


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