In my main form, I am running this:
this.disableForm();
btnAbort.Enabled = true;
disableForm is an extension method for Form in my program defined as the following:
public static void disableForm(this Form f)
{
foreach (Control c in f.Controls)
{
f.Enabled = false;
}
f.Cursor = Cursors.WaitCursor;
}
The problem is that the next command btnAbort.Enabled = true; doesn’t do anything.
It works if I put the code directly in the method and not call disableForm(). Why is this happening? Does it have something to do with threads?
This line:
Should be
The problem is because you are accidentally disabling your entire form.