Of Datagridviews, databinding, and non validating cell values.
- by Yanko Hernández Alvarez
Lets simplify. Lets say I have this class:
class T {
public string Name { get; set; }
public int Age { get; set; }
public int height{ get; set; }
...
}
and I have a DataGridView's DataSource bound to a BindingList <T>, with N columns, each one bound to each property.
I need to:
Allow the user to enter non validating ages, heights, etc (for instance "aaa")
Color the cells with non validating values (red background)
Retain the non validating values displayed until the form is closed (I don't want to lose the values entered until the form is closed, so the user has the option to correct the bad cells anytime he wants BEFORE closing the form)
Keep the last correct values entered for each cell with non validating values entered.
When the form is closed, ditch the non validating values and keep the last correct values entered.
Is there any easy way to do this?