all groups > dotnet windows forms designtime > july 2004 >
You're in the

dotnet windows forms designtime

group:

control throws exception at design time



control throws exception at design time Mitch
7/23/2004 9:21:02 AM
dotnet windows forms designtime: I create a new control (derived from Control, not UserControl).

The OnPaint method is driven by application data. In other words when the
application is running it passes the data to the control, and the control
does the painting. When I drag the control to a form in the VS designer,
that data has not yet been supplied, so VS throws a nullReference exception.
(VS draws a white box with a red border and X)

Can someone suggest a solution?

Thanks

Mitch

Re: control throws exception at design time hirf-spam-me-here NO[at]SPAM gmx.at
7/23/2004 4:33:57 PM
* "Mitch" <xxxxx@avantium.com> scripsit:
[quoted text, click to view]

Inside the 'OnPaint' method, check 'Me.DesignMode' and draw the data only
if it returns 'False'.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
AddThis Social Bookmark Button