Im using some custom control in vb.net, where I have a boolean property that, whenever it changes, it starts a timer if it's value is false or stops if it's true.
If the timer runs for several seconds, it raises a messagebox that warns of a problem happening.
The problem is that this messagebox shows even in design time. As I have traced, the default value for the property is false when the control loads in the winform in design time, it seems it starts the timer and when it ends raises the messagebox, this happens whenever I open the project or rebuild it.
I don't get why this behaviour, as this should only happen at run time but it's driving me crazy, I have tried starting the timer directly when the property changes in the setter and creating "onpropertychanged" events, but this still happens in design time.
Anyone has an idea of how to get rid of this or how to solve it to avoid this of happening, is really disturbing that things happens when the program isn't even running.
Thanks in advance.
The common way is to use the
DesignMode property of the control.
true if the Component is in design mode; otherwise, false.
So in your property, before starting the timer, first check if