lundi 2 novembre 2015

checkbox.Checked dosent update on other forms

I have 2 forms, UserInterface and Client I'm passing checkbox2.Checked info to Client but it only works however it was at launch. When I tick or untick and close and reopenClient it wont notice the change.

Modifiers is Public on checkbox2 at UserInterface form.

Here is Client code:

public partial class Client : Form
    {
        private UserInterface ui1;

        public Client()
        {
            InitializeComponent();
        }
public void CheckBoxCheck()
        {
            if (ui1.checkBox2.Checked == true)
            {
                MessageBox.Show("true");
            }
            else
            {
                MessageBox.Show("false");
            }
        }
    }

If the checkbox is ticked at launch Client will show "true" but if I click it (untick) and run Client it will still show "true".

What do I need to add or modify so checkbox2 will be updated in realtime. Thank you.

Note: I'm pretty new with coding, explanations are appreciated.




Aucun commentaire:

Enregistrer un commentaire