hi, i was wondering if anyone could help me? i am trying to have a button once clicked to display a colour, i have managed to this with the code,
private void button1_Click(object sender, EventArgs e)
{ button1.BackColor = Color.Green; }
i want to know now that the button is green from the first click am i able to create an if statement to detect whether the button is green then to continue to the next method if it is?
many thanks in advance :)
Loading
Pankaj Kumar ChoudharyPosted May 13, 2015, 11:51 AM
if (button1.BackColor != Color.Green)
button1.BackColor = Color.Green;
else
//Your Method call
Dipankar BiswasPosted May 13, 2015, 8:50 AM
u can try it...
private void button1_Click(object sender, EventArgs e)
{
button1.BackColor = Color.Red;
if (button1.BackColor == Color.Red)
{
label1.Text = "You";
}
else
{
label1.Text = "Me";
}
}