Hi Experts. On CeIlEndEdit I am trying to check the number of digits in the cell and if incorrect get the focus back to the cell so that the next key pressed appears in the cell to be corrected. It works sometimes but most times the next key pressed appears in the cell that was selected after leaving the first cell. Any help would be appreciated.
Relevantcell = DataGridView2.CurrentCell
If DataGridView2.CurrentCell.ColumnIndex = 2 Then
If Relevantcell.FormattedValue.ToString.Length < 10 Then
MsgBox("The number is too short")
DataGridView2.CurrentCell = Relevantcell
DataGridView2.BeginEdit(True)
Exit Sub
End If
End If
http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.cellvalidating(v=vs.110).aspx