If you have code in the Load-event of a Windows usercontrol, it will fire when the usercontrol is shown in Visual Studio at design-time. This can be troublesome if the code doesn't compile or needs some runtime-only variables.
However all Windows forms controls (forms, usercontrols etc.) inherits from ComponentModel which in turn has a property that's called DesignMode. This property is true when the Component (control in our case) is shown in designmode in Visual Studio.
Beware for this special case though...
Published by
on Last updated