CurrentCellValidating is normally hit only once. Are you subscribing to this event twice (somehow - say in VB you have both a Handles clause and a AddHandler statement??)?
You can put a stop at the top of your CurrentCellValidating code, and then examine both call stacks when this stop is being hit twice. That may shed some light on what is triggering the double call.
I am not sure what you DisableControls call does, but this might trigger a second validate call. Checking callstack would pick this out. (Stepping through the code in your CurrentCellValidating handler would also pick this up if you leave the stop at the while you step.
If you own our source code and use our Assembly Manager to build and set up for use, debug versions of our libraries, then th call stack would include our library code as well.
AdministratorDecember 31, 2004 07:57 AM UTC
I can find out the cause of the problem. The CurrentCellValidatingEvent is being fired twice because i am setting the Enabled property of GridControl to false in the Disablecontrols functions.
My requirement is if the user does not enter a valid message then i need to display an error message in a message area which i have created. The message area has a OK button . So until the user clicks on OK button the grid cannot get focus. Imagine a case when you show messages using MessageBox.Show method. But i cannot use pop up windows showing error messages. I have to display the error message in the message area.
Can you please tell how can i overcome this problem?
AdministratorDecember 31, 2004 09:15 AM UTC
Can you set a flag before you disable the grid?Then in CurrentCellValidating, test this flag and do not do your validation code if it is set. This way your code would only be hit once. Will this solve your problem?