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:
- I 'Check' the column Header checkbox
- The very first time I click on the 'Clear' button the column header checkbox is unchecked
- I 'Check the column Header checkbox a 2nd time
- 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.