Trigger cellvalidating event
A simple as possible (like it should be if you ask me): * ESCAPE will cancel the Editing and revert the cell Value to the state before the editing * ENTER will trigger an event like "Current Cell Changed" or "Cell Validated"A simple as possible (like it should be if you ask me): * ESCAPE will cancel the Editing and revert the cell Value to the state before the editing * ENTER will trigger an event like "Current Cell Changed" or "Cell Validated" actually it's a default behavior of Data Grid View Text Box Editing Control.
but i don't think that this way is appropriate for you. Moreover, I will use this derived Data Grid View as a standard by now.
Technically speaking you should remove your business logic away from your UI layer and have some sort of Validation Object to validate the data in your presentation layer and then post back the results to your view.
Yeah, I agree with that if it is for validation only.
In a lot of books and articles that I've read on this control, it seems to suggest that the appropriate event to handle for this is the Cell Validating one. However, this event triggers a bit too often for my tastes and I'm not sure it is required.
For example, this event triggers everytimes the users switches to another row.
I am not at work anymore to post my tries now but I will do it tomorrow morning. See you tomorrow :-)without a snippet there is what you have to do: # use Editing Control Showing event to get an editing control # add Key Down event to this control # use Key Down event to catch and handle keys (including ESC, and ENTER) hmm... we have to change the control's style to accept all keys. Here is my test snippet (important part in yellow below): try (destroy Dialog roll_Text Editing) catch() rollout roll_Text Editing "test" width:300 height:250 ( dot Net Control dgv "Data Grid View"; on roll_Text Editing open do ( dgv. But, I can't get it to validate all cells when a button is pressed.I tried calling Validate() but it's not calling the Cell Validating function on every cell Why would you want it to force validation for all cells?