Hi everybody i need a bit of support in my vb coding.

i have publish data on data grid(in vb express 2010) and want to check for the data in each an every row. there are few columns and i want to check the string "OK" under "Status" column. if there is any "Not ok" found then need to prompt a message describing the details of whole row under. any support greatly appreciated.

Dim stringtotest As String = ""
        For i As Integer = 0 To DataGridView1.Rows.Count - 1
            stringtotest = DataGridView1.Item("Status", i).ToString

            MsgBox(stringtotest)

        Next

.dgv(DataGridView) w/3 columns(to display row's values).

Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        verifyRows()
    End Sub
    Sub verifyRows()
        With DataGridView1
            Dim iTemp As Integer = 0
            If .AllowUserToAddRows Then iTemp = 2 Else iTemp = 1 '// check if extra row or not, at bottom of dgv.
            For i As Integer = 0 To .Rows.Count - iTemp
                If .Item("Status", i).Value.ToString.ToLower = "ok" Then
                    MsgBox(.Item(0, i).Value & "/" & .Item(1, i).Value & "/" & .Item(2, i).Value)
                End If
            Next
        End With
    End Sub

Codeorder Thanks for ur detail code. :)
I just gave code to retrive the cell value of Column status at each row. So docgrid can put his efforts to get complete working code.. :)

Thanks Pgmer and codeorder for solutions. you guys really nailed it. :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.