Cellvalidating datagridview c sharp


08-Aug-2019 03:40

When I Check with mouse a row (and so toggle the check Box) I want launch a End Edit() method on my Data Grid View I can do this with an tips : I create a class inherits from Data Grid View Check Box Cell and plug an instance on my column by Cell Template property, this class override On Mouse Down method ...

BUT I want launch something like Cell Validating event on my datagrid (or somewhere) to intercept the check and perhaps cancel the user's change (becaule a rule will not be respected) this event is not launched !!

On the other hand, the Cell Value Changed event seems to trigger only when the value of the cell changes, which means the validation code runs only when the value changes and not everytime a user changes cells.

I doesn't matter if you've edited the text in those cells or not.

Suppose say other table contains some 50 columns, it will be cumbersome job to validate each cell by its column name i.e dgv.columns["ID"].

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.

When a user edit the cell and change the date I woulk like to allow him to write "081501" and programmatically transform the entered date to "2008/15/01"( using a custom method called Transform Date(string ARaw Date)) But I can't find any Data Grid View event to call the Transform Date method and replace the user input by the computed value. Does anybody if this kind of transformation is possible in a Data Grid View and Where is the best place to put the call to the transformation method ?



The Webcam Social Shopper is one example of software that utilizes the webcam in this manner.… continue reading »


Read more

Our goal is simply to be a good web site design and marketing firm and help you become successful as this will enrich our working relationship and help us remain successful.… continue reading »


Read more