mercredi 12 août 2020

user cannot change the checkstate of checkboxes. C# - windows forms

I want to check if a checkbox is checked. therefore I use this code:

if (form.dynamic_checkbox.Checked)
        {
            MessageBox.Show("hello");
            number += 1;
            totalchecked += 1;

where as form is:`

Form1 form = new Form1();

then when I check the checkbox the message box doesn't show up. but when I check the checkbox state in codes with:

form.dynamic_checkbox.Checked = true;

and then the code works and I see the message box. this is bugging me and I need help. I created the checkbox manually form the toolbar. Thanks.

C# - windows forms - .net framework




Aucun commentaire:

Enregistrer un commentaire