Click here to Skip to main content
15,896,118 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
public TemplateForm(bool bChecked)
       {
           InitializeComponent();

           //lblExceeding.Visible = false;
           if (bChecked == true)
               value = 1;
           else
               value = 0;
           ((System.Windows.Forms.Control)(lblExceeding)).Visible = bChecked;
       }



C#
void CheckedChangedEnent(int iIndex, bool bChecked)
        {
            //pUserControl1.objList[iIndex].blnIsChecked = bChecked;

            if (iIndex == 0)
                pUserControl1.blnExceedingClick = bChecked;

            //TemplateForm tmpForm = new TemplateForm(null, null, null, null, null, null, null, null, null, true);
            TemplateForm tmpForm = new TemplateForm(bChecked);
            if (iIndex != 0)
            mDataGridView.Columns[iIndex-1].Visible = bChecked;
            //if (mCheckedListBox.Items.Count)
            //{
            //}
            //tmpForm.lblExceeding.Visible = bChecked;
            ((System.Windows.Forms.Control)(tmpForm.lblExceeding)).Visible = bChecked;
        }
Posted
Updated 9-Sep-15 18:16pm
v2

1 solution

Step1: Add checkbox and double click on the checkbox it will create CheckedChanged event. Inside that method you can implement your logic in Step2.

Step2: Add below code to display/hide your label.
C#
private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
    if (this.checkBox1.Checked) 
    { 
        ((System.Windows.Forms.Control)(lblExceeding)).Visible = true;
    } 
    else 
    { 
         ((System.Windows.Forms.Control)(lblExceeding)).Visible = false;
     }
}
 
Share this answer
 
Comments
Sathish km 10-Sep-15 0:57am    
thks for reply. my checkbox is in user control panel, whenever i check the lbl will either show/hide. i dont want checkBox1_CheckedChanged event

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