That code is not tagging a control, it's tagging a field inside another
object. GetType is returning the control's type, which does not have an
attribute on it. Consider the following:
<FirstAttribute("Hello")> Public Class MyControl
End Class
Public Class MyContainer
<SecondAttribute("Hello2")> Protected WithEvents SectionHeader As
TitleBar
End Class
Now, if you used SectionHeader.GetType().GetCustomAttributes(True), it would
return FirstAttribute, not SecondAttribute, since FirstAttribute is defined
on the MyControl type. If, however you got a FieldInfo object pointing to
the SectionHeader field inside the MyContainerType, it's GetCustomAttributes
would return SecondAttribute.
"WFB" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> At runtime -- I check in the debugger for
> SectionHeader.GetType().GetCustomAttributes(True) and it is not there.
>
> Thanks
> Joe
>
> "Mattias Sjögren" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>>
>>>Howevr I can not see the attribute if i "tag" a control with it, such as;
>>><MyAttribute("hello")> Protected WithEvents SectionHeader As
>>>XYZ.SalesApp.Controls.WebControls.TitleBar, I can not see the attribute.
>>
>>
>> Where are you looking for it?
>>
>>
>>
>> Mattias
>>
>> --
>> Mattias Sjögren [MVP] mattias @ mvps.org
>> http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
>> Please reply only to the newsgroup.
>
>