Change cell background color

Posted on 2007-07-21
Last Modified: 2010-08-05
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

Question by:wiswalld
    LVL 13

    Author Comment

    I figured it out

    Me.Datagridview1.CurrentRow.Cells(7).Style.BackColor() = Color.Red
    LVL 1

    Accepted Solution

    Closed, 125 points refunded.
    Community Support Moderator

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    This video discusses moving either the default database or any database to a new volume.

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    25 Experts available now in Live!

    Get 1:1 Help Now