troubleshooting Question

C# CheckState of a Checkbox

Avatar of huerita37
huerita37Flag for United States of America asked on
ASP.NETC#
13 Comments1 Solution332 ViewsLast Modified:
I dynamically add a datagridview to my form.  When a user types in a number and hits 'Enter' the datagridview is created and populated.  I also add a checkbox in the column header so the user can toggle between checking and unchecking all of the boxes.  My problem comes when the user clicks on the 'Clear' button.  I would like the 'Clear' button to clear the whole grid and 'Uncheck' the column header checkbox if it is checked.  Here is my problem:

  1. I 'Check' the column Header checkbox
  2. The very first time I click on the 'Clear' button the column header checkbox is unchecked
  3. I 'Check the column Header checkbox a 2nd time
  4. I click on the 'Clear' button a 2nd time and everything BUT the column header checkbox is cleared

When I step through my code it is already showing that the column header checkbox is 'Unchecked' when it is actually checked.  It's like the state of the checkbox never gets changed.

I am not sure what to do.  

Any help is appreciated.
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 13 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 13 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros