Change cell background color

This is a follow up to an earlier question. I am copying cells from a datagridview row to another datagridview row (that works). I want to change the value of a cell in the current row to "No" (that works). Now what I want to do is change the background of that cell or the text color.

Dim dr As DataRow = Me._CAD_050107DataSet.Tables("assignedvehicles").NewRow
        'Put values into row
        dr(1) = EventNumber.Text
        dr(2) = Datagridview1.CurrentRow.Cells(1).Value.ToString
        dr(3) = Datagridview1.CurrentRow.Cells(3).Value.ToString
        dr(4) = Datagridview1.CurrentRow.Cells(4).Value.ToString
        Me.Datagridview1.CurrentRow.Cells(7).Value = "No"
        Me.Datagridview1.CurrentRow.Cells(7).BackColor = System.Drawing.Color.Red
                                                     ^
                                               Not working


        'and so on, making sure you put values in any ...
        '... fields/columns that do not allow null


        Me._CAD_050107DataSet.Tables("assignedvehicles").Rows.Add(dr)
LVL 13
wiswalldAsked:
Who is Participating?
 
Vee_ModConnect With a Mentor Commented:
Closed, 125 points refunded.
Vee_Mod
Community Support Moderator
0
 
wiswalldAuthor Commented:
I figured it out

Me.Datagridview1.CurrentRow.Cells(7).Style.BackColor() = Color.Red
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.