ActiveX Controls in .NET and the Enabled bug

18. April 2008 07:04 by Mrojas in General  //  Tags: , , , ,   //   Comments (0)

We found and interesting bug during a migration. The issue was that when there was an iteration through the controls in the forms, and you set the Enabled property, the property didn't get set.

After some research my friend Olman found this workaroung

 

foreach(Control c in Controls)

  ctrl.Enabled = true;
  if (ctrl is AxHost) ((AxHost)ctrl).Enabled = true;
}