I have the following problem:
I made a user control library (DLL), which just has an enabled Timer. When I try to use this control in an application, as soon as I drag it to the Form in design mode, it starts to count! Even if the application is not running.... How can I avoid that?
My objective is that the Timer starts counting as soon as the application is launched, but not in Design Mode... because the Timer uses some external functions that cause the crash in the Design Mode.
Thank you in advanced!
Dario
You can check the DesignMode
property of Control
:
if (!this.DesignMode) {
// its not in design mode.. so do stuff.
}
Or perhaps neater:
yourTimer.Enabled = !this.DesignMode;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With