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. Graphics
  4. How to highlight the particular row in Datagrid?

How to highlight the particular row in Datagrid?

Scheduled Pinned Locked Moved Graphics
graphicstutorialquestion
5 Posts 3 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.
  • G Offline
    G Offline
    gtag
    wrote on last edited by
    #1

    I am using Datagrid in my application. And at the same time i want to highlight particular row in datagrid. Using graphics class i tried to draw a rectangle on the row but drawn rectangle is invisible. In formload, datagrid is there. And in application depending upon the event rectangle should be drawn on the datagrid on particular row. Please assist me in this.

    T H 2 Replies Last reply
    0
    • G gtag

      I am using Datagrid in my application. And at the same time i want to highlight particular row in datagrid. Using graphics class i tried to draw a rectangle on the row but drawn rectangle is invisible. In formload, datagrid is there. And in application depending upon the event rectangle should be drawn on the datagrid on particular row. Please assist me in this.

      T Offline
      T Offline
      Tim Craig
      wrote on last edited by
      #2

      Didn't you just ask this same question about 2 messages below using the name gayatrit, delete it, set up a new ID, and ask it again?

      If you don't have the data, you're just another asshole with an opinion.

      modified on Saturday, June 7, 2008 3:10 AM

      1 Reply Last reply
      0
      • G gtag

        I am using Datagrid in my application. And at the same time i want to highlight particular row in datagrid. Using graphics class i tried to draw a rectangle on the row but drawn rectangle is invisible. In formload, datagrid is there. And in application depending upon the event rectangle should be drawn on the datagrid on particular row. Please assist me in this.

        H Offline
        H Offline
        Harvey Saayman
        wrote on last edited by
        #3

        foreach (DataGridViewRow row in dataGridView.Rows) { row.DefaultCellStyle.BackColor = Color.Tomato; } You can add if statements within the foreach to change row colors according to conditions like so foreach (DataGridViewRow row in dataGridView.Rows) { if (row.Cells[13].Value.ToString() == "someValue") { row.DefaultCellStyle.BackColor = Color.Tomato; } else if(row.Cells[13].Value.ToString() == "someOtherValue") { row.DefaultCellStyle.BackColor = Color.Blue; } } hope it helps

        Harvey Saayman - South Africa Junior Developer .Net, C#, SQL

        you.suck = (you.passion != Programming)

        G H 2 Replies Last reply
        0
        • H Harvey Saayman

          foreach (DataGridViewRow row in dataGridView.Rows) { row.DefaultCellStyle.BackColor = Color.Tomato; } You can add if statements within the foreach to change row colors according to conditions like so foreach (DataGridViewRow row in dataGridView.Rows) { if (row.Cells[13].Value.ToString() == "someValue") { row.DefaultCellStyle.BackColor = Color.Tomato; } else if(row.Cells[13].Value.ToString() == "someOtherValue") { row.DefaultCellStyle.BackColor = Color.Blue; } } hope it helps

          Harvey Saayman - South Africa Junior Developer .Net, C#, SQL

          you.suck = (you.passion != Programming)

          G Offline
          G Offline
          gtag
          wrote on last edited by
          #4

          Thank u Mr.Harvey it worked :)

          1 Reply Last reply
          0
          • H Harvey Saayman

            foreach (DataGridViewRow row in dataGridView.Rows) { row.DefaultCellStyle.BackColor = Color.Tomato; } You can add if statements within the foreach to change row colors according to conditions like so foreach (DataGridViewRow row in dataGridView.Rows) { if (row.Cells[13].Value.ToString() == "someValue") { row.DefaultCellStyle.BackColor = Color.Tomato; } else if(row.Cells[13].Value.ToString() == "someOtherValue") { row.DefaultCellStyle.BackColor = Color.Blue; } } hope it helps

            Harvey Saayman - South Africa Junior Developer .Net, C#, SQL

            you.suck = (you.passion != Programming)

            H Offline
            H Offline
            Harvey Saayman
            wrote on last edited by
            #5

            glad to have helped

            Harvey Saayman - South Africa Junior Developer .Net, C#, SQL

            you.suck = (you.passion != Programming)

            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