Home > Mobile >  how can I pass the checkbox value from one form to another form?
how can I pass the checkbox value from one form to another form?

Time:09-17

I want to design two forms. One form offer a checkbox and a 'confirm' button for user to select, another form display a message box to detect once the user check the checkbox and click the confirm button.

public Form1()
{
    if (Form2.confirmButtonClicked == true)
    {
        if(Form2.checkbox1.checked == true)
        {
            MessageBox.Show("You check the checkbox");
        }
    }
}
public Form2()
{
    if (checkbox.checked == true)
    {
        return checkbox.checked;
    }
}

Sorry I am new to c#, and my question might too simple to you. Please kindly teach me because I had read those examples from online and do not know how to troubleshoot this.

Thanks.

CodePudding user response:

I also had this problem a long time ago. To solve this issue, I wrote a class file for this work and published it on GitHub so that others can use it as well.

It is very easy to use, I explained in the repository (use my project in github)

enter image description here

  • Related