Click here to Skip to main content
15,905,028 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i have a tabcontrol containing many controls ,each tabpage inside the tabcontrol have checkboxes and i have a select all checkbox outside the tabcontrol .I need all the checkboxes to get checked when i check the selectalll checkboxesAs many checboxes are dynamically made visible/invisible i have adde a condition if the checkbox is visible then the checked stat can be changed but when i select a tabpag only the ones visible in that page are selected when i switch to the other tab the checkboxes are not selected

C#
private void SelectAllChkBx(bool flagset)
       {
           if (this.checkbox1.Visible == true)
               this.checkbox1.Checked = flagset;
if (this.checkbox2.Visible == true)
               this.checkbox2.Checked = flagset;
if (this.checkbox3.Visible == true)
               this.checkbox3.Checked = flagset;
if (this.checkbox4.Visible == true)
               this.checkbox4.Checked = flagset;
       }
Posted

1 solution

Checkboxes on other tabs are not visibe (Visible == false; even if the VisibleChanged event was not been raised), so they are not updated by your code.
Consider to use Enabled property to flag the chackbox should not been updated.
 
Share this answer
 
v2

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