Problem:
In .Net Winforms how can a user hide controls when a checkbox is checked ?
Resolution:
In WinForms there is a CheckedChanged event for a CheckBox. You can use this and the "Checked" property of the checkbox to hide controls as required.
The simplest way to hide a control is by setting the "Visible" property of a control to false.
Some example code that does this is:-
method-id. "cboxHide_CheckedChanged" final private.
linkage section.
01 sender System-Object.
01 e System-EventArgs.
procedure division using by value sender e.
if self::"cboxHide"::"Checked"
set self::"txtBox1"::"Visible" to true
set self::"lblHide"::"Visible" to true
else
set self::"txtBox1"::"Visible" to false
set self::"lblHide"::"Visible" to false
end-if
end method "cboxHide_CheckedChanged".
As you can see it hides/shows a textbox and label as required.
