Home All Groups Group Topic Archive Search About

XML Comments and ComponentModel.Description attribute

Author
31 Jan 2006 3:49 AM
CMM
In VS2005 / VB.NET, do you still have to spell out the
ComponentModel.Description attribute when you want properties of a custom
control to have description text in the Property Editor?... or can you use
XML Comments take the place of this? If you still need to specify both, why
can't the XML Comments shortcut (''') automatically pick up the
ComponentModel.Description already defined for the Property....

With the VBCommenter power toy add-in in VS2003 you could type ''' and the
XML Comments would automatically be filled in with the value of
ComponentModel.Description attribute already specified for the property.

If so, this yet another "little thing" where VS2005 is completely
half-assed. I swear the more I use this thing the more I'm infuriated by its
total brainlessness. I hope I'm wrong. I really hope I'm wrong.

Author
31 Jan 2006 7:19 AM
Herfried K. Wagner [MVP]
"CMM" <cmm@nospam.com> schrieb:
> In VS2005 / VB.NET, do you still have to spell out the
> ComponentModel.Description attribute when you want properties of a custom
> control to have description text in the Property Editor?... or can you use
> XML Comments take the place of this?

You have to specify both, but importing the 'System.ComponentModel'
namespace will make your code more readable:

\\\
Imports System.ComponentModel    ' Alternatively use a project-wide import.
....
<Description("...")> _
Public Property...
///

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>
Author
31 Jan 2006 7:44 AM
CMM
I can't believe the VBCommenter power toy add-in in VS2003 is better than
the functionality in the super-hyped up VS2005! That says a lot.
Anyway... I came up with a very nice time-saver by creating a code snippet
for it and assigning it a "cmprop + tab" as a shortcut key (using the VB
Code Snipper Editor...
http://msdn.microsoft.com/vbasic/downloads/tools/snippeteditor/).
''' <summary>
''' $description$
''' </summary>
<ComponentModel.Description("$description$")> _


Show quoteHide quote
"Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message
news:uTI77ajJGHA.1728@TK2MSFTNGP09.phx.gbl...
> "CMM" <cmm@nospam.com> schrieb:
>> In VS2005 / VB.NET, do you still have to spell out the
>> ComponentModel.Description attribute when you want properties of a custom
>> control to have description text in the Property Editor?... or can you
>> use XML Comments take the place of this?
>
> You have to specify both, but importing the 'System.ComponentModel'
> namespace will make your code more readable:
>
> \\\
> Imports System.ComponentModel    ' Alternatively use a project-wide
> import.
> ...
> <Description("...")> _
> Public Property...
> ///
>
> --
> M S   Herfried K. Wagner
> M V P  <URL:http://dotnet.mvps.org/>
> V B   <URL:http://classicvb.org/petition/>