Datagridview cellstyle

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Steve

    #1

    Datagridview cellstyle

    Hi All

    I am using VB.net 2005 professional

    I set the background color of a datagridview cell to different colors
    depending on many reasons

    I set them in the cellformatting event and all works great, i.e the colors
    appear as requested
    e.g e.CellStyle.Bac kColor = Color.Red

    When I try to read the color in Datagridview.mo useclick event using...
    If
    dgvgroup.Rows(h it.RowIndex).Ce lls(hit.ColumnI ndex).Inherited Style.BackColor
    = mycolor Then

    it always returns false

    end if

    Note: mycolor = color.salmonpin k and actual grid cell color =
    color.salmonpin k

    but
    dgvgroup.Rows(h it.RowIndex).Ce lls(hit.ColumnI ndex).Inherited Style.BackColor
    returns color.honeydew which is the defaultcellstyl e.backcolor set in

    datagridview properties defaultcellstyl e in design environment

    what am I doing wrong

    Regards

    Steve


Working...