Link to home
Start Free TrialLog in
Avatar of mpharis
mpharis

asked on

Windows Form DataGridView - RowValidating Event Not Firing

I'm Developing a Windows Forms application with a datagridview bound to a datasource. In the process of validating some cell values the RowValidating Event does not fire when navagation moves off the row. Works fine moving to Next Row. However, if i change a cell value, Tab back to the left to another cell on the same row, then use the mouse to click on a Previous row above the changed row..... the RowValidating Event does not occur.
Example::
   A B  C D
1 x  x  x  x
2 x  x  x  x
3 x  x  x  x

If I change the value in C2, then backtab (or mouse click) back to B2, Then mouse click on any cell in row 1, the RowValidation Event does not fire and thus the changed value in C2 does not get evaluated. I am manually handling the Datasource Update which is dependant on the validations. Please advise ...
SOLUTION
Avatar of Jorge Paulino
Jorge Paulino
Flag of Portugal image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mpharis
mpharis

ASKER

Therein lies the initial problem. I am using CellValidating but if one cell is dependant on another I cannot navagate away from the invalid cell to change the parent cell controlling the validation logic. Example:
I have both a "Company" column and a "Division" Column. Both columns may have a valid entry for each independent cell but there are only certain valid "Divisions" for a given "Company". I was attempting to use Cell validation for the individual values and then apply RowValidating to ensure the validity of the group "Company and Division".  Otherwise,  a valid company and division would pass the first line of validations and allow the Update of an Invalid Company/Division combination.
I'm open to other approach to this kind of issue?
Can you show what you're doing ?
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial