15-11-19, 05:30 PM
(آخر تعديل لهذه المشاركة : 15-11-19, 05:42 PM {2} بواسطة sofiane-phy.)
(15-11-19, 02:53 PM)asemshahen5 كتب : جرب هذا الكود :
PHP كود :
For Each dgvrow As DataGridViewRow In Dgv_Table.Rows
If dgvrow.IsNewRow Then Exit For
If dgvrow.Cells(0).Value = 0 Then
dgvrow.Cells(0).Style.BackColor = Color.Red
dgvrow.Cells(0).Style.ForeColor = Color.White
End If
Next
بارك الله فيك ، استعملت الكود و لم ينجح معي ووجدت هذا الكود اثناء البحث :
كود :
Private Sub dgvw_CellFormatting(sender As Object, e As DataGridViewCellFormattingEventArgs) Handles dgvw.CellFormatting
Dim row As DataGridViewRow = dgvw.Rows(e.RowIndex)
Dim obj As Object = row.Cells("Expr1").Value
If Not IsDBNull(row.Cells("Expr1").Value) Then
If row.Cells("Expr1").Value <= 0 Then
row.DefaultCellStyle.BackColor = Color.Red
ElseIf row.Cells("Expr1").Value > 0 Then
row.DefaultCellStyle.BackColor = Color.White
End If
End If
Return
------------------------
منكم أتعلم
------------------------