Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Property defiened As Image cannot be deleted

Status
Not open for further replies.

shareman

Programmer
Aug 25, 2004
6
IL
Hi all!
Supppose we have a UserControl with very simple code:

Code:
    Private m_MyImage As Image 

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

Now we see the property in PropertyGrid. We choose an image - everything is fine - the image appears in PropertyGrid. But now we want to delete it - select the "System.Drawing.Bitmap" at the grid cell, press Del or Backspace...ooooups... Nothing happens. We just cannot delete it in any way! The property is pinned forever! Try to do the same with any "native" property, like BackgoundImage for Form - you can set and delete it freely.
Why?
I am confused...
 
use

imports System.ComponentModel

and then:

Code:
 <Browsable(True), Category("Appearance"), DefaultValue(GetType(Image), "Nothing")> _
    Public Property MyImage() As Image
        Get
            Return m_MyImage
        End Get
        Set(ByVal Value As Image)
            m_MyImage = Value
        End Set
    End Property


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top