dimanche 25 janvier 2015

c# Revert on checkbox unchecked

My goal is when the checkbox is unchecked to have label1 return to it's value before the checkbox was checked.



private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
{
if
(checkBox1.Checked)
label1.Text = textBox1.Text + label1.Text;

else

label1.Text = label1.Text; //return to previous value?
}
}


The way mentioned above, label1 'sticks' to the value when the checkbox is unchecked.


I tried using the label1.Refresh but it didn't work.


Is there a more effective way to get the result I'm looking for?





Aucun commentaire:

Enregistrer un commentaire