Okay now you have learned about buttons and textboxes at basics.
What is checkboxes used for?
A checkbox is used to check for more choices.
You can use it for making vote buttons, using them instead putting 100Buttons or anything else.
Checkboxes are pretty cool to use in a windows form application.
Now we are gonna look at checkboxes.
First you have to make 2 checkboxes.
One with the Text "Yes" and the other with the Text "No".
(Think back to Button, how to change text)
No create a button and make text "My Choice is?".
Then double click on the button.
Now we will need to make 3 checks for it.
One for first checkbox.
One for second checkbox.
One for that both is checked.
One for that nothing is checked.
Okay so far.
Now how do we make the checks?.
Simply create one:
Code:
if (checkBox1.Checked == true)
{
MessageBox.Show("You have choosed yes.");
}
Code:
else if (checkBox2.Checked == true)
{
MessageBox.Show("You have choosed No.");
}
else if (checkBox1.Checked == true && checkBox2.Checked == true)
{
MessageBox.Show("You have choosed both.");
}
else
{
MessageBox.Show("Please make a choice");
}
}
Congratulations you have now created a checkbox.
You can try combine it with Part 1.
Other controls with checkbox/radiobuttons, thanks to DarkMessiah:
in Part 3 we will look at creating a text creatorQuote:
Originally Posted by DarkMessiahyou can use
will make it more efficient.Code:if(checkBox1.Checked) { //do stuff }
also, it will never reach the "both checked" state since you used if/else's.
radio buttons in a panel to do yes/no or true/false option choices.
Like notepad.

Any problems post a reply or send me a PM.






