Datagridview cellvalidating date

End Edit() Dim dte Start Time As Date Time If Not Date. End If block because it shows that the current cell value is the old valid date, not the invalid entry that is currently in the cell. The trouble that I am having is that IF I enter a valid date, and then later come back to the cell and enter an invalid date, on the Cell Validating event, it skips over this If... Data Grid View Cell Cancel Event Args) Handles Data Grid View1. Column Index = 2) Then Dim rect1 As Rectangle = Me. Column Index = 3) Then Dim rect2 As Rectangle = Me. Cancel = True End If This code works fine the first time the cell is edited.

There are error text and error icons to help with this.

I want it to go back to the value it was before the error occurs. I event tried to edit the value before the data error event fired. Error Text = "" Dim new Integer As Integer dgv Invoices.

If i'm unclear somewhere, or if you need more information then just explain what's needed.

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.

355

Leave a Reply