abledating zip - C dgv cell validating

Since i have a column name as "Item Name" which is supposed to be entered as text there is an issue in the code.

When the validation fails, the editor is closed, but the user cannot change the current row in the grid until a valid cell value is entered.

In this situation the editor is not kept active when the validation fails and pressing the Esc key does not revert the changes as the editor is already closed.

so if i select invalid date i have to click another place in the datagrid view for the error msg to to i avoid this and make the event trigger after the cell value is beign selected?????

I would like to manipulate a cell in my Data Grid View when it is validating so that if the user enters a value that is not valid for the database, but is easily converted to valid data, the program will change the value to an appropriate one.

provides a convenient way to realize data validation before it is committed to the underlying data source.

SOLUTION To achieve data validation prior the row is committed, you can handle the Cell Validating event, which is raised by the control when the current cell changes or when it goes out of edit mode.I have a windows form application which contains a datgridview.I need to enforce cell validations on the datagridview cells so that it does not accept negative values.Is there a way to change the dgv cell Style Format and cell Tag from within the Cell Validating event?I've tried a few things and have searched for answers without luck so far.The Event Args usually has a Cancel property that if set to true will block the user from leaving the data entry field (cell, textbox, etc.).

Tags: , ,