I don’t know my way right or wrong when i want to start some jobs, i will disable all control and enable again when jobs completed. This is my code :
public void EnableControls(bool isenable){
this.BeginInvoke(new MethodInvoker(delegate()
{
foreach (System.Windows.Forms.Control control in this.Controls)
{
control.Enabled = isenable;
}
}));}
with : this is form control
Everybody can explain me that this code is wrong or right. When i use many threads, i see controls cannot enable and i don’t know why. Thanks !
If you want to
enable/disableall controls in the form, you can just useform.Enabledinstead. If however there are some controls that you don’t want to take a part in enable/disable you can put all controls that are interested inPanelorGroupBoxandEnable/Disablepanel. And at least if you can’t usePanel, your code is fine in this case