Click here to Skip to main content
16,012,166 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Uncheck CheckBox, which is added on GridHeader using rectangle when uncheck one of the CheckBox in GridView in Winforms.

I added CheckBox on GridHeader like this.
C#
Rectangle rect = DGVSalesDetails.GetCellDisplayRectangle(0, -1, true);
rect.Y = 3;
rect.X = rect.Location.X + (rect.Width / 8);
CheckBox checkboxHeader = new CheckBox();
checkboxHeader.Name = "checkboxHeader";
checkboxHeader.Size = new Size(18, 18);
checkboxHeader.Location = rect.Location;
headerCheckboxRightMargin = (rect.Width - checkboxHeader.Width) / 2; 
 checkboxHeader.CheckedChanged += new EventHandler(checkboxHeader_CheckedChanged);
DGVSalesDetails.Controls.Add(checkboxHeader);

I want to uncheck this CheckBox automatically when DGVSalesDetails_CurrentCellDirtyStateChanged is called.
Posted
v4
Comments
BulletVictim 17-Sep-13 2:07am    
What exactly is the problem here? Are you not able to reference "checkboxHeader" in "DGVSalesDetails_CurrentCellDirtyStateChanged"? or what? Because looking at your code that is the first problem I could see that you might have
The first line is very hard to understand. Please elaborate again.

Solution is available within codeproject.:)
This link will solve your problem.

Toggling the States of all CheckBoxes Inside a DataGridView Column[^]
 
Share this answer
 
Question not clear please elaborate more on this.
 
Share this answer
 
Comments
This is not an answer. Please delete this and if you want to reply to Question, then click on "Have a Question or Comment" below the Question.
Saikumar Guptha 18-Sep-13 2:35am    
Thanks For Replaying for My question ...I was Solved the Problem Myself....

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900