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. Windows Forms
  4. how change specific row back color in DataGrid?

how change specific row back color in DataGrid?

Scheduled Pinned Locked Moved Windows Forms
question
7 Posts 4 Posters 3 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.
  • Z Offline
    Z Offline
    zeroonea
    wrote on last edited by
    #1

    how change specific row back color in DataGrid? i have a DataGrid with some rows, how change row back color, like set row 1 with back color is red, row 2 is blue, row 3 is yellow thanks

    O 1 Reply Last reply
    0
    • Z zeroonea

      how change specific row back color in DataGrid? i have a DataGrid with some rows, how change row back color, like set row 1 with back color is red, row 2 is blue, row 3 is yellow thanks

      O Offline
      O Offline
      ozzyrocsdbn
      wrote on last edited by
      #2

      What infomation are you showing like a report

      Z S 2 Replies Last reply
      0
      • O ozzyrocsdbn

        What infomation are you showing like a report

        Z Offline
        Z Offline
        zeroonea
        wrote on last edited by
        #3

        no, i only want change specific row back color, and i want know how to do that ? thanks

        R 1 Reply Last reply
        0
        • Z zeroonea

          no, i only want change specific row back color, and i want know how to do that ? thanks

          R Offline
          R Offline
          RepliCrux
          wrote on last edited by
          #4

          I don't think you can do that in Windows Forms.

          Z 1 Reply Last reply
          0
          • R RepliCrux

            I don't think you can do that in Windows Forms.

            Z Offline
            Z Offline
            zeroonea
            wrote on last edited by
            #5

            i think can be done, but i don't know how? like properties BackColor of DataGrid, it change bg color of odd number row

            R 1 Reply Last reply
            0
            • Z zeroonea

              i think can be done, but i don't know how? like properties BackColor of DataGrid, it change bg color of odd number row

              R Offline
              R Offline
              RepliCrux
              wrote on last edited by
              #6

              I was just wondering because datagrid does not have a Row(s) property.

              1 Reply Last reply
              0
              • O ozzyrocsdbn

                What infomation are you showing like a report

                S Offline
                S Offline
                Stu Richardson
                wrote on last edited by
                #7

                Sorry a bit of a late reply but hopefully this will still help you. You can set a rows color using the following line: dataGridView1.Rows[i].DefaultCellStyle.BackColor = Color.Blue; (where 'i' is the current row as i am assuming you will have a loop so you can set the color depending on the row index). You can also set the default row and cell styles using the properties window however this will apply to every cell and row.

                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