Link to home
Start Free TrialLog in
Avatar of wiswalld
wiswalldFlag for United States of America

asked on

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)
Avatar of wiswalld
wiswalld
Flag of United States of America image

ASKER

I figured it out

Me.Datagridview1.CurrentRow.Cells(7).Style.BackColor() = Color.Red
ASKER CERTIFIED SOLUTION
Avatar of Vee_Mod
Vee_Mod
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial