I have two sections(primary and secondary) in a form with several textboxes which display information. On the secondary section I've added a checkbox (which when checked) I want to copy the information from the fields on the primary section into the fields on the secondary side. If its unchecked I want it to leave the field as blank.
Here is some sample code to help see what I am trying to do:
The CheckChanged event calls four different methods (each method contains logic for a specific checkbox):
private void CheckBoxCheckedChanged(
{
Method1();
Method2();
Method3();
Method4();
}
When Method4 is called I'd like to process the logic mentioned above if its checked, and leave blank if its not.
private void Method4()
{
if (checkBox4.Checked = true)
{
secondaryTextbox.Text = primaryTextbox.Text;
}
else if (checkBox4.Checked = false)
{
secondaryTextbox.Text = "";
}
}
The issue I'm having is that when I do this once the checkbox is checked, I can no longer 'uncheck' to change the field back to being blank.
What am I doing wrong, or is there a better way to go about this?
I apologize ahead of time if I posted this wrong, this is my first time using SO.