I have a bound DataGridView1 and several bound TextBoxes and DateTimePickers.
Everything is working well, except when I try to accomplish these two things in conjunction
DGV shows edited value after cell validation and this seems to be an issue around DGV. In order to do that (considered as workaround) you can simulate/force by yourself your grid validation (calling the method below) after you have setted the value on your cell:
Private Sub SimulateDGVValidation()
Try
Dim currentCell As DataGridViewCell = Me.DataGridView1.CurrentCell
If (currentCell) IsNot Nothing Then
Dim c As Integer = IIf(currentCell.ColumnIndex > 1, currentCell.ColumnIndex - 1, 1)
Me.DataGridView1.CurrentCell = Me.DataGridView1(c, currentCell.RowIndex)
Else
Me.DataGridView1.CurrentCell = Me.DataGridView1(0, 0)
End If
Application.DoEvents()
'Return in the initial cell
If (currentCell) IsNot Nothing Then
Me.DataGridView1.CurrentCell = currentCell
End If
Catch ex As Exception
Console.WriteLine(ex.ToString)
End Try
End Sub