The CheckBox and Radio Button controls are the most used controls Windows Application.
Difference between a Check Box Control and a Radio Button Control:
CheckBox control and Radio Button Control both are used for selection items from the list of items. The only difference between checkbox and radio button is "check box is used to select more than one item. Whereas by using radio button, one can select only one item in the list".
Check Box and Radio Button uses
Description
CheckBox control is used when the developer wants to set the user to select more than one option where as the radio button is used when the user has to choose one option from the list.
Example 1
Assume there are the list of languages. In this case, one have to use checkbox because there are the people who know multiple languages.
Assume there is a list called gender. In this case, one have to use radio button because the user should be a male or female. The user only has one option to choose here. If a checkbox used instead of a radio button, then there is a chance to get an error if the user checks both options. Here error means the violation of rules and regulations that the client wants.
Check Box and Radio Button Controls, both have the same default event called CheckedChanged. The checkedchanged event will raise when the user selects the check box control or radio button control.
Example 2
Take the above given example. If the client wants to allow the people who know certain languages they mentioned and the people only be Male or Female. Follow the below steps to develop this application
Step 1
Design the form like below.
Step 2
Write the below code under the submit button Click event
[csharp] private void btnSubmit_Click(object sender, EventArgs e)
{
MessageBox.Show("Registration Successful");
}[/csharp]
Step 3
This code is just for the user-friendly message. Then, the output will be display as shown in the below figure.