Checkbox Visible property value type is System.Boolean, so we can only assign true or false for this property value.
The following c# example code demonstrate us how can we show or hide a checkbox control dynamically at run time in a C# Windows Form Application.
C# Code:
1 2 3 4 5 6 7 8 9 10 11 12 |
protected void Button1_Click(object sender, System.EventArgs e) { CheckBox1.Visible = false; Label1.Text = "CheckBox Hide."; } protected void Button2_Click(object sender, System.EventArgs e) { CheckBox1.Visible = true; Label1.Text = "CheckBox Visible."; } |