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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. Visual Basic
  4. Setting background color or image to individual cells in a data Grid view?

Setting background color or image to individual cells in a data Grid view?

Scheduled Pinned Locked Moved Visual Basic
cssdatabasequestion
2 Posts 2 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
    Benny_Lava
    wrote on last edited by
    #1

    Hi, I have a cellMouseClick event on my dataGridView. When I click a mouse on a individual cell, based od cell index I must set a background color or an image on a individual cell? I know that this is possible on an entire column. But on a individual cell? Thank you!

    A 1 Reply Last reply
    0
    • B Benny_Lava

      Hi, I have a cellMouseClick event on my dataGridView. When I click a mouse on a individual cell, based od cell index I must set a background color or an image on a individual cell? I know that this is possible on an entire column. But on a individual cell? Thank you!

      A Offline
      A Offline
      Ashfield
      wrote on last edited by
      #2

      You do it int he datagridview_CellFormatting event.

      private sub dgv1_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)

      if days = 5
      then
      e.CellStyle.Font = new Font(e.CellStyle.Font.Name, e.CellStyle.Font.Size, FontStyle.Bold)
      e.CellStyle.BackColor = Color.Orange
      end if
      end sub

      Hope this helps

      Bob Ashfield Consultants Ltd

      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