Register for your free account! | Forgot your password?

You last visited: Today at 08:11

  • Please register to post and access all features, it's quick, easy and FREE!


[Part2]C# - Checkboxes (Windows Form)

Discussion on [Part2]C# - Checkboxes (Windows Form) within the CO2 Programming forum part of the CO2 Main - Discussions / Questions category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Apr 2010
Posts: 109
Received Thanks: 55
[Part2]C# - Checkboxes (Windows Form)

Part 2 - Checkboxes
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.");
}
and then 3 more else could be like this:
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");
}
}
Now it will checks for what you have checked.
Congratulations you have now created a checkbox.
You can try combine it with Part 1.

Other controls with checkbox/radiobuttons, thanks to DarkMessiah:
Quote:
Originally Posted by DarkMessiah
you can use
Code:
if(checkBox1.Checked)
{
     //do stuff
}
will make it more efficient.

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.
in Part 3 we will look at creating a text creator
Like notepad.



Any problems post a reply or send me a PM.



©Hyperlink is offline  
Old 04/27/2010, 14:35   #2
 
elite*gold: 0
Join Date: Oct 2009
Posts: 128
Received Thanks: 50
Shouldn't this be moved to for closer topic alignment?


s.bat is offline  
Old 04/27/2010, 19:05   #3
 
elite*gold: 0
Join Date: Apr 2010
Posts: 109
Received Thanks: 55
maybe, i dont know
I just thought here, since other programming tutorials are here and the other forums are just only german speak x.x
©Hyperlink is offline  
Old 04/27/2010, 22:15   #4
 
elite*gold: 0
Join Date: Aug 2006
Posts: 127
Received Thanks: 5
Really nice and understandable tutorial, keep it up


Matic^ is offline  
Thanks
1 User
Old 04/27/2010, 22:29   #5
 
elite*gold: 0
Join Date: Jan 2007
Posts: 177
Received Thanks: 57
Quote:
Originally Posted by ©Hyperlink View Post
...
you can use
Code:
if(checkBox1.Checked)
{
     //do stuff
}
will make it more efficient.

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.
DarkMessiah is offline  
Old 04/27/2010, 23:51   #6
 
elite*gold: 0
Join Date: Apr 2010
Posts: 109
Received Thanks: 55
Quote:
Originally Posted by DarkMessiah View Post
you can use
Code:
if(checkBox1.Checked)
{
     //do stuff
}
will make it more efficient.

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.
I will add that to tutorial


©Hyperlink is offline  
Reply



« Proxy bot language | [Part3]C# - TextEditor (Windows Form) »

Similar Threads
[Part3]C# - TextEditor (Windows Form)
04/28/2010 - CO2 Programming - 0 Replies
Now we will look at some more advanced things like creating a text editor, with load/save files. First create a windowsformapplication. Make sure you name it: TextEditor Now delete the "Form1.cs". Now right click at your solution and choose: Add > Windows Form Make the name: TextEditor Now make the design fit into what you want.
windows form
04/20/2010 - CO2 PServer - Discussions / Questions - 4 Replies
okay i made this windows form application. But how do i save it as a program, so i can make it to a rar file, so it can be used. lol is an easy question, dont flame me or ill report. And close this after i got answer.
C# Windows Form Application Errors
02/17/2010 - CO2 PServer - Discussions / Questions - 4 Replies
When I open up a new project, even before I do anything I get these errors in Program.cs: Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(fals e); Application.Run(new Form1()); How can I fix these?
Image on Windows Form,
02/08/2010 - CO2 PServer - Discussions / Questions - 6 Replies
Anyone knows how to add the very small Image, of an Application Icon on a C# Windows form Application, Like, http://img237.imageshack.us/img237/5849/imageke.png flako27-
Windows form...
11/15/2008 - CO2 PServer - Discussions / Questions - 9 Replies
//



All times are GMT +2. The time now is 08:11.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.

BTC: 3KeUpz52VCbhmLwuwydqxu6U1xsgbT8YT5
ETH: 0xc6ec801B7563A4376751F33b0573308aDa611E05

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2019 elitepvpers All Rights Reserved.