king_jeremy
Member
- Joined
- Oct 20, 2009
- Messages
- 13
- Programming Experience
- Beginner
Hi,
I have a datagridview on a form and when I set errors on a column with setColumnError method the hasErrors evaluates just fine but when I set errors by DataGridView(RowIndex).ErrorText, hasErrors ignores it. What is it that I'm missing here?
This is the code I use
I have a datagridview on a form and when I set errors on a column with setColumnError method the hasErrors evaluates just fine but when I set errors by DataGridView(RowIndex).ErrorText, hasErrors ignores it. What is it that I'm missing here?
This is the code I use
VB.NET:
Private Sub StudentsDataGridView_CellEndEdit(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles StudentsDataGridView.CellEndEdit
If e.ColumnIndex = 1 Then
For i As Integer = 0 To StudentsDataGridView.Rows.Count - 2
If i <> e.RowIndex Then
If Not IsDBNull(StudentsDataGridView(1, e.RowIndex).Value) AndAlso _
Not IsDBNull(StudentsDataGridView(1, i).Value) Then
If StudentsDataGridView(1, e.RowIndex).Value = StudentsDataGridView(1, i).Value Then
StudentsDataGridView(1, e.RowIndex).ErrorText = "This student name has been defined!"
Exit For
Else
StudentsDataGridView(1, e.RowIndex).ErrorText = ""
End If
End If
End If
Next
End If
End Sub
Last edited: