Sam

Sam

  • NA
  • 166
  • 0

Moving events out of the Designer ?

Apr 1 2014 6:50 AM
Hi,
I have a form with many controls, each having events (and their handlers), total some tens events .
I found out that many times, due to complex combinations, events are being fired while the controls are being initiated, mainly because I load saved settings from my settings file that may change the default controls' initial settings, causing events to fire.

To avoid this, I moved all my events to a special method (in Main) that is being called only after all controls have been built and and set.

It works fine, but the question is if this is good or common practice and what drawbacks it may have.

I have also tried to move the events to a special Maim subclass, but could not find a way to get access to the private controls from the subclass.

Answers (2)