Hi,
Try something like this
Private Sub DataGrid1_CurrentCellChanged(ByVal sender As Object, ByVal e
As System.EventArgs) Handles DataGrid1.CurrentCellChanged
newCurrentRow = DataGrid1.CurrentCell.RowNumber
newCurrentCol = DataGrid1.CurrentCell.ColumnNumber
Dim newText As String
Try
newText = DataGrid1(oldCurrentRow, oldCurrentCol).ToString()
If newCurrentRow <> oldCurrentRow Then
Dim x As Integer
For x = 0 To 2
Dim strTemp As String = DataGrid1(oldCurrentRow,
x).ToString
If strTemp = "" Then
DataGrid1.CurrentCell = New
DataGridCell(oldCurrentRow, x)
Return
End If
Next
End If
Catch
newText = ""
End Try
If newCurrentCol = 2 Then
For x As Integer = 0 To 1
Dim strTemp As String = DataGrid1(newCurrentRow, x).ToString
If strTemp = "" Then
MessageBox.Show("Please enter this value here first")
DataGrid1.CurrentCell = New DataGridCell(newCurrentRow,
x)
Return
End If
Next
End If
If okToValidate And Not IsValidValue(oldCurrentRow, oldCurrentCol,
newText) Then
MessageBox.Show("Entry Error")
okToValidate = False
DataGrid1.CurrentCell = New DataGridCell(oldCurrentRow,
oldCurrentCol)
okToValidate = True
Else
oldCurrentRow = newCurrentRow
oldCurrentCol = newCurrentCol
End If
End Sub
Ken