更新时间:2023-02-20 15:17:01
Hi Sudeshna,
Here i am giving you the code for your problem.
So do as you have done adding the data to the datagrid view. Now add these code for evaluation of the rowdata and its values for coloring.
<code>Dim i As Integer
For i = 0 To DataGridView1.Rows.Count - 1
If IsNothing(DataGridView1.Rows(i).Cells(0).Value) Then
DataGridView1.Rows(i).DefaultCellStyle.BackColor = Color.Green
Else
DataGridView1.Rows(i).DefaultCellStyle.BackColor = Color.Red
End If
Next</code>
here the cells(0) refers to the column where the date data is entered. I think it will solve your problem.
Thank you
For Each rw As GridViewRow In dgrd_WWWH.Rows
If String.IsNullOrEmpty(rw.Cells("date").ToString()) Then
rw.BackColor = Drawing.Color.Green
Else
rw.BackColor = Drawing.Color.Red
End If
Next
此代码用于asp.net vb代码
this code for asp.net vb code