I've looked at other people with similar problems, but none of the suggested fixes are working for me. I have a simple function that returns whether a checkbox is checked or not, and another method from another class uses this info.
Whenever I change the "Checked" property to false before running the form, my code works as expected and treats the boolean variable for the checked property as false. However, if i try to change the checkbox while the form is actually running, my code always treats the checked property as true regardless of whether the box is checked or not.
My code is not a Form1_Load one time thing, it is a function that is called every time a button is clicked. (Of course this button was clicked after the checkbox was untoggled, and it still treats the checkbox checked variable as true even though it should be false.)
Literally my code:
(I understand this looks like a weird way to check it, but it's needed because of class to class referencing issues)
public bool Check1()
{
check1 = this.checkBox1.Checked;
return check1;
}
Check1(); always returns true regardless of whether checkBox1 is checked or not. But again, if I uncheck the checkbox prior to running the form, it returns false as it should.
Any suggestions to get it to update properly?
Aucun commentaire:
Enregistrer un commentaire