我的代码是这样的: 我只是一个bignner,我无法让这个代码为我工作。请帮助我
Private Sub dgvOrdersData_CellFormatting(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellFormattingEventArgs) Handles dgvOrdersData.CellFormatting
If e.RowIndex <> dgvOrdersData.NewRowIndex Then
If e.ColumnIndex = dgvOrdersData.Columns("CashOrCredit").Index Then
If e.Value.ToString = "Credit" Then
dgvOrdersData.Rows(e.RowIndex).DefaultCellStyle.BackColor = Color.Yellow
Else
dgvOrdersData.Rows(e.RowIndex).DefaultCellStyle.BackColor = Nothing
End If
End If
If e.ColumnIndex = dgvOrdersData.Columns("Job").Index Then
If e.Value.ToString = "PendingJob" Then
dgvOrdersData.Rows(e.RowIndex).DefaultCellStyle.BackColor = Color.Red
Else
dgvOrdersData.Rows(e.RowIndex).DefaultCellStyle.BackColor = Nothing
End If
End If
If e.ColumnIndex = dgvOrdersData.Columns("Job").Index AND e.ColumnIndex = dgvOrdersData.Columns("CashOrCredit").Index Then
If e.Value.ToString = "PendingJob & Credit " Then
dgvOrdersData.Rows(e.RowIndex).DefaultCellStyle.BackColor = Color.Pink
Else
dgvOrdersData.Rows(e.RowIndex).DefaultCellStyle.BackColor = Nothing
End If
End If
End If
End Sub