i need some c# help please
-
- Posts: 140
- Joined: Sat Jul 29, 2006 9:11 pm
- Location: Klein, TX
i need some c# help please
how would i code for different stuff to happen if a checkbox is checked and then a button is pressed, like if one is checked a message boxe will come up and say something? please help, im starting with the basics of c# because i want to start making modding programs and i think c# would be the language of choice. thank you
i dont want a sig!
For this, and many problems in coding, you will want to use an "If, Then" statement. I have written a sample of code that shows you how to implement this in C#
Assuming you have objects named button1, checkbox1, and checkbox2, this will find which checkboxes are checked, if any, and pop up a message box that tells you which box is checked. For more help with C#, watch the video tutorials on the MSDN website, they are a great starting point.
Code: Select all
private void button1_Click(object sender, EventArgs e)
{
if (checkBox1.Checked == true)
if (checkBox2.Checked==true)
MessageBox.Show("You checked Checkbox1 and 2");
else
MessageBox.Show("You checked Checkbox1");
else if (checkBox2.Checked == true)
MessageBox.Show("You checked Checkbox2");
else
MessageBox.Show("No Checkbox was checked");
}
Last edited by an emu on Tue Jan 02, 2007 10:00 pm, edited 1 time in total.
-
- Posts: 140
- Joined: Sat Jul 29, 2006 9:11 pm
- Location: Klein, TX