Groups | Blog | Home
all groups > vb.net controls > november 2004 >

vb.net controls : Problem deleting image property


Richard L Rosenheim
11/30/2004 6:09:42 PM
I created an user control which contains an image property. Utilizing the
property page, I can select an image file, and the control will display it.
But, I'm unable to clear the value from the property page. That is, when I
select the entry in the property page, and hit the delete key, the property
page won't set the value to "none".

I have the property coded as:

Public Property MyImage() as Image
Get
Return _MyImage
End Get
Set (ByVal Value As Image)
_MyImage = Value
End Set
End Property

I'm assuming I'm missing something. Maybe an attribute? Anyone have any
ideas?

TIA,

Richard Rosenheim

Richard L Rosenheim
11/30/2004 7:47:46 PM
I stumbled across the answer. I needed to add the DefaultValueAttribute to
the property. Specifically, the line:

<DefaultValue(GetType(Image), "None")>

Richard Rosenheim


[quoted text, click to view]

AddThis Social Bookmark Button