Home > DeveloperSection > Forums > How to Know status of Check Box is checked or unchecked
Anupam Mishra

Total Post:135

Points:949
Posted on    January-20-2016 2:49 AM

 C# C#  .NET 
Ratings:


 1 Reply(s)
 178  View(s)
Rate this:
I want to use check box  and it will working on button click event , how to know check box is checked or unchecked(status) .After knowing status , i want to do some task.
thank you.


Anupam Mishra

Total Post:135

Points:949
Posted on    January-20-2016 6:41 AM

Here, we are using a groupBox container that add checkbox controls in a form. Code is same as below:
        CheckBox check = new CheckBox();
     check.AutoSize = false;
        check.Text = "This is check box";
                    check.AutoSize = true;
                    check.Location = new Point(50, 50);
                    groupBox1.Controls.Add(check);

Here, we are code for checking checkbox status ,it is checked or unchecked :
        if ((check).Checked)
                     {
                      MessageBox.Show("checkbox is checked", "Test", MessageBoxButtons.OK, MessageBoxIcon.Question);
                    // Here you can code as you wish
                }

or we also checked a status of check box by using check.CheckStatus property.


Don't want to miss updates? Please click the below button!

Follow MindStick