Thursday, May 24, 2012

Highlight Grid cells based on Process

Here im posting some of the pieces for coding in vb.net

For Each row As DataGridViewRow In DataGridView1.Rows

            For i = 0 To DataGridView1.Columns.Count - 1
                If (row.Cells(Column1.Name).Value = True) Then
                    ' row.Cells(txt.Name).Value = "hello"
                    'DataGridView1.Rows(i).Selected = True
                    'row.Cells(2).Value = TextBox1.Text
                    row.Cells(3).Style.BackColor = Color.White


                    row.Cells(3).Value = "Received"



                    com1.CommandText = "update IOC_status set status='" & row.Cells(3).Value & "' where IOC_no='" & row.Cells(2).Value & "'"


                    com1.Connection = con


                    com1.ExecuteNonQuery()


                End If


# a  method to highlight rows in data grid and also to update values in datagrid rows to a database

No comments: