Click here to Skip to main content
15,907,493 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
My project contains 4 check boxes and 2 buttons which will open two new form with same check box values which were on my first form(if selected, they will appear as selected on two forms, if not selected they will appear as normal) in which if we select 3 check boxes and click 2nd button it open a new form and a label should display 200. If i select another text box the label should update to 300 and increment ++ and if i unchecked checkbox, the value should be decrease!! any help from you can be appreciable! thank you
Posted
Comments
Alvaro Santiesteban 15-Mar-15 0:49am    
Are you using Visual Studio?
Maciej Los 15-Mar-15 4:44am    
What you mean by saying "Form": WinForm or WebControl?

1 solution

Have you tried to add a parameter to the constructor of your forms?
This can be done in many ways and the code below is just one example:
C#
public class Form2 : Form
{
    public Form2(params bool checkBoxValues)
    {
        InitializeComponent();
        
        if (checkBoxValues.Length > 0)
            checkBox1.Checked = checkBoxValues[0];
        if (checkBoxValues.Length > 1)
            checkBox2.Checked = checkBoxValues[1];
        if (checkBoxValues.Length > 2)
            checkBox3.Checked = checkBoxValues[2];
    }
}

Form2 frm = new Form2(checkBox1.Checked, checkBox2.Checked, checkBox3.Checked);
frm.ShowDialog();
 
Share this answer
 

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