Controls, properties, events and timers running in design time

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 DesignMode is False.


  • Does Reporting Services embedded in WinForm need SQL Server?
  • Activator.CreateInstance MissingMethodException
  • ExpatError: not well-formed (invalid token)
  • Why are there differences in psych::principal between “Varimax” and “varimax”?
  • Variable scope in Python nested function [duplicate]
  • Why gcc does not produce type mismatch warning for int and char?
  • What to look for when setting UpdateBatchSize
  • Differences between index-assignment in Numpy and Theano's set_subtensor()
  • “Value does not fall within the expected range” when opening RandomAccessStream
  • Timer is not working in separate class in C#
  • adding item to window Extjs 4
  • C++ std::set comparator
  • Why does NotifyIcon not set SynchronizationContext?
  • Basler USB Camera byte buffer to image conversion
  • Add a div to replace Video after Video Plays Through
  • overlapping appointments using the entity framework
  • What is Closure Compiler?
  • Remove previous Directions Route Google Maps
  • Programatically open file in visual studio
  • You tube videos are not playing
  • Double dispatch in Java example
  • Problem with Django using Apache2 (mod_wsgi), Occassionally is “unable to import from module” for no
  • hibernate sets dirty flag (and issues update) even though client did not change value
  • How to set elevation color?
  • Can I programmatically choose the Android layout folder?
  • Loading .coffee files via a view in Rails
  • Why is the size of this struct 32?
  • Problems to linebreak with an int in JLabel
  • Why HTML5 Canvas with a larger size stretch a drawn line?
  • recyclerView does not call the onBindViewHolder when scroll in the view
  • TFS: Get latest causes slow project reloading
  • Join two tables and save into third-sql
  • Arrow is showed instead of the material design version hamburger icon. Why doesn't syncState in
  • How to model a transition system with SPIN
  • Updated Ionic CLI but shows previous version (Windows)
  • ORA-29908: missing primary invocation for ancillary operator
  • How do I rollback to a specific git commit
  • Setting background image for body element in xhtml (for different monitors and resolutions)
  • Can Visual Studio XAML designer handle font family names with spaces as a resource?
  • Converting MP3 duration time