R
Rob Blackmore
I am trying to create an attribute of type Icon and have the following code:
<AttributeUsage(AttributeTargets.Class)> _
Public Class PIMSGridViewIconAttribute
Inherits System.Attribute
'/// Private variables
Private oPiGridViewIcon As System.Drawing.Icon = Nothing
'/// Construtor
Public Sub New(ByVal Value As System.Drawing.Icon)
oPiGridViewIcon = Value
End Sub
'/// Public properties
Public ReadOnly Property GridViewIcon() As System.Drawing.Icon
Get
Return oPiGridViewIcon
End Get
End Property
End Class
And then on a class I attempt to set it to an icon within a resource file
with:
<PIMSGridViewIcon(My.Resources.resIcons.Team)> _
However, this gives an error of "Constant expression is required.". Please
can someone advise what I am doing wrong and how I can set the attributes
value per class?
Kind regards
Rob
<AttributeUsage(AttributeTargets.Class)> _
Public Class PIMSGridViewIconAttribute
Inherits System.Attribute
'/// Private variables
Private oPiGridViewIcon As System.Drawing.Icon = Nothing
'/// Construtor
Public Sub New(ByVal Value As System.Drawing.Icon)
oPiGridViewIcon = Value
End Sub
'/// Public properties
Public ReadOnly Property GridViewIcon() As System.Drawing.Icon
Get
Return oPiGridViewIcon
End Get
End Property
End Class
And then on a class I attempt to set it to an icon within a resource file
with:
<PIMSGridViewIcon(My.Resources.resIcons.Team)> _
However, this gives an error of "Constant expression is required.". Please
can someone advise what I am doing wrong and how I can set the attributes
value per class?
Kind regards
Rob