You should add a bracket
{ after the
else
keyword. You should also add another bracket at the end of your method:
private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
if(checkBox1.Checked)
{
FlashingName = true;
timer1.Enabled = true;
timer1.Start();
}
else
{
FlashingName = false;
timer1.Enabled = false;
timer1.Stop();
}
}
[EDIT]
By the way,
timer1.Enabled = true;
does the same as
timer1.Start();
and
timer1.Enabled = false;
does the same as
timer1.Stop();
So you can simply optimize your code by writing this:
private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
FlashingName = checkBox1.Checked;
timer1.Enabled = checkBox1.Checked;
}
If
checkBox1.Checked
is
true
, then
FlashingName
and
timer1.Enabled
will be
true
also. Same if
checkBox1.Checked
is
false
:
tiemr1.Enabled
and
FlashingName
will be
false