views:

50

answers:

1

I've made a custom control with values for start, current, and end times. The current time has to be between the start and end times, or else an exception is thrown.

In the designer, I want to set new start, current and end times; and the new current time is valid for the new start and end, but not the default start and end. However, the designer sets the current time first, so the exception is thrown, and the designer is replaced with the designer exception message.

How do I tell the designer to set the start and end times before setting the current time?

+3  A: 

That's what ISupportInitialize is for. Just inherit this interface, the designer will automatically call your control's BeginInit() and EndInit() methods. Don't use the assigned property values until EndInit().

Hans Passant