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 8139153
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T11:43:54+00:00 2026-06-06T11:43:54+00:00

I have a DataGridView with a checkbox column. I’m trying to create a select/deselect

  • 0

I have a DataGridView with a checkbox column. I’m trying to create a select/deselect all button. The code for changing the values is easy enough, but the performance is horrendous.

for (int i = 0; i < dgv.RowCount; i++)
{
    dgv.Rows[i].Cells["Selected"].Value = _selectAll;
}

_selectAll is simply a toggle bool variable. Is there a better way to do this where the performance is fast? I’ve tried changing the value in the underlying DataTable as well. It still takes several seconds for just a few hundred rows, but most work will be done on thousands of rows.

EDIT & SOLUTION (2011/10/4)

The main problem was in the DGV properties. Once I set,

dgv.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.DisplayedCells;

performance improved dramatically (per MSDN DataGridView Performance).
The solutions suggested as of this edit would also improve performance slightly.

  • 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-06-06T11:43:56+00:00Added an answer on June 6, 2026 at 11:43 am

    Thanks a lot, by setting the AutoSizeColumnsMode property

    dgv.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.DisplayedCells;
    

    the performance is much better…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have datagridview with checkbox column, but I want, that some of the columns
I have a datagridview with a column with checkbox in it. What I am
hi i have a datagridview whose first column (index = 0) is a checkbox
Ok, the first column in my datagridview is a checkbox. I have 'multiselect' set
I have datagridview with checkbox column, and the checkbox within the column can be
I have a datagridview that I've added a checkbox column to. When I preview
I currently have a class and I'm trying to create an easy GUI to
I have a datagridview with a checkbox column at the beginning, what i want
I have a DataGridView with a text column and a checkbox column. When the
I have a dataGrid(not dataGridView) in which i need to add Checkbox dynamically at

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.