Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7415127
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T07:14:18+00:00 2026-05-29T07:14:18+00:00

EDIT: trying to excute the following code in Winforms. I am fetching the data

  • 0

EDIT: trying to excute the following code in Winforms.

I am fetching the data from xml & they are shown in the datagridview using custom class i have created.I have linked every column with DataPropertyName

I want to show datagridview textboxes, buttoncolumn , checkbox in datagrid like the following image.

enter image description here

I am using following event to change the color of the button i have added. For particular element, suppose i am binding dt to the single row of grid, then

if(dt.val=="true")
          {
// change the color of that button
          }

i am using following code.

 private void Grid_DataBindingComplete(object sender, DataGridViewBindingCompleteEventArgs e)
{
DataGridViewColumn dt = Grid.Columns[9]; // 9 is column no

            foreach (DataGridViewRow r in Grid.Rows)
            { 
                if (newList[r.Index].val.ToString() == "true") //some condition
                {
                    r.DefaultCellStyle = red; // this turns compete row red

                   // add something here to make button red of this row 
                }
             else 
                {
                    r.DefaultCellStyle = green;
                   // add something here to make button red of this row 

                }


            }
}
  1. I am unable to change the color of particular cell button.
  2. How do i add checkboxes in last row, as i have already added DataGridViewCheckboxColumn but by default grid is not showing any column.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T07:14:18+00:00Added an answer on May 29, 2026 at 7:14 am

    You would change the background color of a specific cell like this:

    r.Cells(9).Style.BackColor = Drawing.Color.Red
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im trying to hammer togehter a WYSIWYG-edit in c# following some examples from here
I'm using LINQ-to-Entities. Using the following query: var x = from u in context.Users
The following block of code works fine (no errors) $query = select * from
I am trying to send email using the following method in my action class:
I'm trying to execute the following code: <label for=gender>Gender*: </label> <select name=user[test] id=gender> <?
I'm trying to write the following spec using Specs2 but can't seem to get
I'm trying to make the following code work with no success protected BackgroundTask<?> backgroundTask
edit: I was trying to solve a spoj problem. Here is the link to
I'm trying to edit the output joomla main_menu module so I can make a
I'm trying to edit a textbox's text in a Page_Load form on an ASP.NET

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.