Master-detail datagridviews :cannot prevent user from leaving invalid detail cell

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nina4ever
    New Member
    • Oct 2014
    • 3

    Master-detail datagridviews :cannot prevent user from leaving invalid detail cell

    in my WinForms app. i have master-detail DatagridViews.
    i have a RowValidating and CellValidating event handlers on detail grid.

    if detail cell/row validation fails, i set e.Cancel to TRUE.
    this prevents user from leaving cell/row in details grid, EXCEPT in one case :

    when user inserts invalid data in details cell and directly moves focus to master grid to a record in which is not its parent, then user is not prevented from leaving that invalid cell !

    further more, when i return back to THAT invalid cell, i discover that invalid value wasn't accepted, and cell has its old value.

    another case: if i delete cell's value instead of inserting an invalid value, e.Cancel is also set to TRUE because that value is required. i repeat the previous scenario and when i get back to that cell, i find it EMPTY, not even having its old value...

    can anyway tell me how to prevent user from leaving invalid detail cell (i.e. cancel invalid cell leaving) ?
    Last edited by nina4ever; Oct 12 '14, 11:25 AM. Reason: changed title
Working...