If a user has altered his assignments in dgd Eligible Files (checked/unchecked one/more rows) without clicking the Save button at form-bottom, and then clicks another row in dgd Applications, I currently use dgd Applications_Row Validating to pop a messagebox and verify that the user wants to proceed to the newly-selected application/row without saving changes. Row Validating and the user chooses "Yes" to continue (abandoning changes in dgd Eligible Files and going to the new row in dgd Applications), dgd Applications_Mouse Click does not get executed and nothing changes in dgd Eligble Files. When I put break points in both the Row Validating and Mouse Click event handlers, I never see Mouse Click execute - I only see Row Validating.
How can I get dgd Applications_Mouse Click to execute? So, evidence seems to sugest that Row Validating executes first - that seems to be confirmed in this: codeproject.com/Articles/240221/Data Grid View-Event-Sequences.
dgd Applications is set for Full Row Select and validation (Causes Vailidation = true).
dgd Eligible Files contains a list of files & file info, and a checkbox column - if a row is checked, the file it represents is "assigned" to the selected row in dgd Applications (a row/application in dgd Applications may have many files assigned to it). If "Yes", I want to proceed with dgd Applications_Mouse Click on the new row, which will do the following: clear the checkboxes in dgd Eligible Files, retrieve the list of files for the newly selected app in dgd Applications, and update checked/selected values in the underlying list bound to dgd Eligible Files (followed by dgd Eligible Files. My problem: When the messagebox is displayed in dgd Applications.
Any advice would help a lot, and examples help me a ton as I'm a visual learner.
If you need any code or information please ask and I'll post it, I'm not sure what to post as there hasn't been customization in the event handlers.
How can I stop this behavior from validating every time a cell loses focus?
My other question is this: as I said before in my non-EF form with the Data Grid Views, when I add a row it adds a negative number as the ID which is the PK. In the EF form, I can click in the cell and edit it, and it doesn't add a negative number and while it may not make the numbers consecutive I can edit them myself and fix them. The only difference is one's datagridviews are created from EF data source and the others are created from a raw sql database data source.
Also how can I make the cells in ID column editable like in the EF form.
I'm not clear on which process you think I should do in a Leave event.
I don't see how I can put the clear/list-retrieval/checkbox-setting for dgd Eligible Files in a Leave event of dgd Applications - that would be putting the cart before the horse, as the potential "cancel" would happen after the processing for the newly selected row has already occurred.
I'd appreciate your thoughts (and anyone else's) as to why I see only the Row Validating and not the Mouse Click, given what you said.
In the meantime, I will look at the "leave" events as you suggested.
When the cell loses focus, I get the error because it failed the validating.