Custom control: Allow null property value

D

Derrick

I have created a custom control, and for one of its properties it is
possible that the value may be null. However, at design time when a null
value is assigned, I get the error "The object 'myControl1' returned null
for the property 'TheProperty' but this is not allowed".

The property itself is a custom Collection object (extending
CollectionBase), so I could use an empty collection instead of null as a
last resort, but I would much rather have a null object instead.

How can I allow null values?

Thanks,

Derrick
 
M

Michael Giagnocavo [MVP]

Using an empty collection is the preferred way to design libraries.
-mike
MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top