Note that there are some explanatory texts on larger screens.

plurals
  1. POWhat is the best practice to handle CheckBox Control in WinForm?
    primarykey
    data
    text
    <p>The winform:<br> <a href="http://i36.tinypic.com/2r26a77.png" rel="nofollow noreferrer">alt text http://i36.tinypic.com/2r26a77.png</a> </p> <p>The code:</p> <pre><code>using System; using System.Windows.Forms; namespace DemoApp { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void checkBox1_CheckedChanged(object sender, EventArgs e) { groupBox2.Enabled = checkBox1.Checked; } private void button1_Click(object sender, EventArgs e) { SaveSetings(); } private void SaveSetings() { Properties.Settings.Default.UserName = textBox1.Text; Properties.Settings.Default.pass = textBox2.Text; Properties.Settings.Default.userproxy = checkBox1.Checked; Properties.Settings.Default.proxy = textBox3.Text; Properties.Settings.Default.proxy_port = textBox4.Text; Properties.Settings.Default.Save(); } //private void Form1_Load(object sender, EventArgs e) //{ // checkBox1.Refresh(); // groupBox2.Enabled = checkBox1.Checked; //} } } </code></pre> <p>As u can see in the code I have “Use Proxy” checkbox which is when selected should enable groupbox1 or vice versa. The problem is when the form is loading setting from “user.config“even if the check control is unselected groupbox 1 is enabled. One way to handle this situation is to check for the control in form load event i.e. </p> <pre><code>groupBox2.Enabled = checkBox1.Checked; </code></pre> <p>is there any other to do this and make my application more dinamic? The reason I am asking this is because there can be situations where multiple controls are on a single form, and I think it will become confusing.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload