Private Sub DataGridView1_CellFormatting(ByVal sender As Object, ByVal e As DataGridViewCellFormattingEventArgs) Handles DataGridView1.CellFormatting
' تحديد العمود الذي ترغب في تلوين قيمه
Dim targetColumnIndex As Integer = 5 ' تغيير القيمة حسب رقم العمود الخاص بك
If e.ColumnIndex = targetColumnIndex AndAlso e.Value IsNot Nothing Then
Dim cellValue As String = e.Value.ToString()
' التحقق من القيمة وتعيين الألوان المناسبة
If cellValue = "Facebook" Then
e.CellStyle.BackColor = Color.Yellow
e.CellStyle.ForeColor = Color.Black
ElseIf cellValue = "Excellent" Then
e.CellStyle.BackColor = Color.LightGreen
e.CellStyle.ForeColor = Color.Black
ElseIf cellValue = "Excellent" Then
e.CellStyle.BackColor = Color.LightGreen
e.CellStyle.ForeColor = Color.Black
ElseIf cellValue = "Excellent" Then
e.CellStyle.BackColor = Color.LightGreen
e.CellStyle.ForeColor = Color.Black
ElseIf cellValue = "Excellent" Then
e.CellStyle.BackColor = Color.LightGreen
e.CellStyle.ForeColor = Color.Black
End If
' يمكنك إضافة المزيد من الشروط حسب احتياجاتك
' قم بتعيين القيمة المعدلة إلى الخلية
e.Value = cellValue
End If
End Sub
End Class