Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. How to change DataGridView row bg color if modified

How to change DataGridView row bg color if modified

Scheduled Pinned Locked Moved Database
cssdatabasehelptutoriallounge
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    BambooMoon
    wrote on last edited by
    #1

    I need to find a way to change the background color of rows in my DataGridView if the row is marked as modified. Note that this is not the same as changing the background color of a cell when its value changes. The latter can be done easily through the CellValidating and CellValidated events, though this is completely unsatisfactory because the change in color gets lost when you sort a column. But I need the whole row's background color to change. This seems to imply to me that I need to override the cell classes to override their Paint handlers. The difficulty with this is that in the Paint handler of a cell I can't find a way to get access to the cell's bound DataRow to tell if its RowState is modified. I can only see a way to get hold of the DataRow for the currently selected grid row, not for any row in general. If the grid has been sorted, then you cannot use the cell's grid row to index correctly into the dataset's table. Any definitive help would be greatly appreciated. -- modified at 12:12 Friday 10th February, 2006

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups