954,514 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

check data gird data in vb

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.

docgrid
Newbie Poster
9 posts since Feb 2012
Reputation Points: 10
Solved Threads: 0
 
Dim stringtotest As String = ""
        For i As Integer = 0 To DataGridView1.Rows.Count - 1
            stringtotest = DataGridView1.Item("Status", i).ToString

            MsgBox(stringtotest)

        Next
Pgmer
Master Poster
714 posts since Apr 2008
Reputation Points: 54
Solved Threads: 121
 

.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
Posting Virtuoso
1,913 posts since Aug 2010
Reputation Points: 255
Solved Threads: 384
 

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.. :)

Pgmer
Master Poster
714 posts since Apr 2008
Reputation Points: 54
Solved Threads: 121
 

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

docgrid
Newbie Poster
9 posts since Feb 2012
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: