Friday, October 4, 2013

how to stop show message or exit for in the example ?

how to stop show message or exit for When the condition is checks , Iam try (exit for) but dont stop (for , next)


please help



Private Sub Table_1DataGridView_CellStateChanged(sender As Object, e As DataGridViewCellStateChangedEventArgs) Handles Table_1DataGridView.CellStateChanged
For i As Integer = 0 To Me.Table_1DataGridView.RowCount - 2
For j As Integer = i + 1 To Me.Table_1DataGridView.RowCount - 2
If Table_1DataGridView.Rows(i).Cells(1).Value = Table_1DataGridView.Rows(j).Cells(1).Value Then
MessageBox.Show("duplicate value : " & Table_1DataGridView.Rows(i).Cells(1).Value)
Table_1DataGridView.Rows(i).Cells(1).Selected = True
Exit For
End If
Next
Next
End Sub


No comments:

Post a Comment