Hi, I did checkout many solutions on daniweb but couldn't get anything positive. i am new to vb.my idea to is to cycle through the cell values of particular column in a datagridview. and if duplicates are found, display them in a message box.

Dim wacko As String
wacko = DataGridView1.Rows(0).Cells(1).Value
For m As Integer = 0 To DataGridView1.Rows.Count
If DataGridView1.Rows(m).Cells(1).Value = wacko Then
wacko = DataGridView1.Rows(m).Cells(1).Value
End If

Now this is a very basic concept, but the problem is when the last row value is returned,
i get an indexing error

"Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index"

i tried to count-1, but that doesnt cover everything. And even easier, would be to set no
duplicate allowed in the datatable itself. but i want to fill those particualr rows with color. Any suggestion will be helpful.

I think u need this

See the image first...

Dim wacko As String
        Dim li As Integer = 0
        For i As Integer = 0 To DataGridView1.Rows.Count - 1
            wacko = DataGridView1.Rows(i).Cells(1).Value
            li = i
            For m As Integer = i + 1 To DataGridView1.Rows.Count - 1
                If DataGridView1.Rows(m).Cells(1).Value = wacko Then
                    DataGridView1.Rows(m).Cells(1).Style.BackColor = Color.Red
                    DataGridView1.Rows(li).Cells(1).Style.BackColor = Color.Red
                End If

If not then please clarify your problem.....

And please use CODE tag when u post code......