tags:

views:

29

answers:

1

Hi, i wrote a custom attribute and got the following Color property that I want the user to be able to indicate the color property in the attribute on a class:

    Private _ColumnColor As System.Drawing.Color
    Public Property ColumnColor() As System.Drawing.Color
        Get
            Return _ColumnColor
        End Get
        Set(ByVal value As System.Drawing.Color)
            _ColumnColor = value
        End Set
    End Property

I'm getting the following error:

"Property or field 'ColumnColor' does not have a valid attribute type

How can I resolve?

Thanks

A: 

I would start with adding the AttributeUsage to your property

<AttributeUsage(AttributeTargets.Property)> _
Private _ColumnColor As System.Drawing.Color
    Public Property ColumnColor() As System.Drawing.Color
        Get
            Return _ColumnColor
        End Get
        Set(ByVal value As System.Drawing.Color)
            _ColumnColor = value
        End Set
    End Property
PsychoCoder
Nope, I get an error that the data type is allowed.
Lennie