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. General Programming
  3. Visual Basic
  4. How to Change Cell Backcolor if Datagridview2.item.value = Datagridview1.item.value [modified]

How to Change Cell Backcolor if Datagridview2.item.value = Datagridview1.item.value [modified]

Scheduled Pinned Locked Moved Visual Basic
comtutorial
5 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.
  • I Offline
    I Offline
    ikanbobo
    wrote on last edited by
    #1

    i want to make program like this: if DataGridView2.item(SID).value = DataGridView1.item(LID).value then color=green else color=red i want all item list in DataGridView2.item(SID).value will be checked. not only first cell i mean like this(see the picture): http://i43.tinypic.com/9posc2.jpg

    modified on Thursday, February 26, 2009 8:24 AM

    S 1 Reply Last reply
    0
    • I ikanbobo

      i want to make program like this: if DataGridView2.item(SID).value = DataGridView1.item(LID).value then color=green else color=red i want all item list in DataGridView2.item(SID).value will be checked. not only first cell i mean like this(see the picture): http://i43.tinypic.com/9posc2.jpg

      modified on Thursday, February 26, 2009 8:24 AM

      S Offline
      S Offline
      Sebastian Br
      wrote on last edited by
      #2

      Colouring the background of a DataGridView-Cell works as following listed: Dim cs As DataGridViewCellStyle cs = New DataGridViewCellStyle cs.BackColor = Color.Green aDataGridView.Rows(r).Cells(c).Style = cs Note, that the above code overwrites existing CellStyles you already assigned to a cell (maybe via the GUI-Design-Tool and so on). For a complete row, you could use instead: aDataGridView.Rows(r).DefaultCellStyle.BackColor = Color.Green

      modified on Thursday, February 26, 2009 7:45 AM

      I 1 Reply Last reply
      0
      • S Sebastian Br

        Colouring the background of a DataGridView-Cell works as following listed: Dim cs As DataGridViewCellStyle cs = New DataGridViewCellStyle cs.BackColor = Color.Green aDataGridView.Rows(r).Cells(c).Style = cs Note, that the above code overwrites existing CellStyles you already assigned to a cell (maybe via the GUI-Design-Tool and so on). For a complete row, you could use instead: aDataGridView.Rows(r).DefaultCellStyle.BackColor = Color.Green

        modified on Thursday, February 26, 2009 7:45 AM

        I Offline
        I Offline
        ikanbobo
        wrote on last edited by
        #3

        Seee picturee.... http://i43.tinypic.com/9posc2.jpg If DataGridView2.Item("BLnumber2", e.RowIndex).Value = DataGridView1.Item("BLNumber1", e.RowIndex).Value Then

        modified on Thursday, February 26, 2009 9:19 AM

        S 1 Reply Last reply
        0
        • I ikanbobo

          Seee picturee.... http://i43.tinypic.com/9posc2.jpg If DataGridView2.Item("BLnumber2", e.RowIndex).Value = DataGridView1.Item("BLNumber1", e.RowIndex).Value Then

          modified on Thursday, February 26, 2009 9:19 AM

          S Offline
          S Offline
          Sebastian Br
          wrote on last edited by
          #4

          What exactly you need to know?

          I 1 Reply Last reply
          0
          • S Sebastian Br

            What exactly you need to know?

            I Offline
            I Offline
            ikanbobo
            wrote on last edited by
            #5

            see the picture: http://i43.tinypic.com/9posc2.jpg

            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