I have the following code in a portion of my program that hides/shows certain elements based on the status of a certain checkbox:
private void enableFolderVariableRemoval_CheckedChanged(object sender, EventArgs e)
{
if (enableFolderVariableRemoval.Checked)
{
cleanFolderTextPanel.Visible = true;
cleanTextPanel.Visible = true;
}
else
{
cleanFolderTextPanel.Visible = false;
if (cleanFilenameTextPanel.Visible == false)
{
cleanTextPanel.Visible = false;
}
}
}
Is there a better way to handle this without a whole bunch of conditionals that set other controls to hide/show?