Adding description to method?

L

lisa

In VS.NET, when you hit . and get a list of possible properties and
methods, a tooltip comes up that gives you the footprint of each
method, and often a description of what the method is for.

When I create my own control and add properties and methods, the
tooltip appears the same way. But there's no description, which makes
sense, because I didn't add one.

So my question is: How do I add one?

Thanks.
 
L

lisa

Thanks, Steve. Unfortunately, I don't think that works for methods.
From what I've seen, you can only get custom description on methods to
work in C#. Which would be great, except that's not the choice my
employer made. <sigh>

Thanks again,
Lisa
 
J

johndoe

These are called XML comments and are provided via the /// in C#. From the
looks at it VB.NET currently does not support Inline Comments the way C#
does. This is on the feature-list for vb.net 2005 supposedly. so this
inforamtion may be completely useless to you in which case skip down to the
end.
if you type /// on the line before a method then VS.NET will automatically
insert an xml comment for the method. Note that this is 3 /'s versus the

/// <summary>
/// Adds a Dental Patient
/// </summary>
/// <param name="dp">New dental patient to add.</param>
/// <returns>Returns the new index that the patient was added at.</returns>
public Int32 Add (DentalPatient dp)

Your comment goes in between the <summary> tags. Parameter description goes
in between param.

Disclaimer: VS.NET's IntelliSense can be EXTREMELY broken so this very well
may end up not working or maybe it works some of the times. I use a plugin
offered by WholeTomato which enhances my Intelli-Sense so this ensures that
this works all the time. Therefore if it doesnt work and you have made sure
that all of the assemblies are updated and reflecting the new one then this
may very well be why.

Somebody claims that VS.NET can't even do it See
http://www.dotnet4all.com/Dot-Net-Books/2005/01/adding-method-descriptions.html and so if the above sample does not work for you
http://www.gotdotnet.com/team/ide/


Hope this helps.
 
S

Shark Bait

I think this is want you want. Go into project properties ("XML Document
File") and output the XML too...
/// <summary>
/// Returns a DataSet using a stored procedure and SqlParameter array passed
to it.
/// </summary>
/// <param name="storedProc">Stored procedure name.</param>
/// <param name="sqlParams">A SQL Parameter array.</param>
/// <param name="tableName">Table name you want returned to you in the
DataSet.</param>
/// <returns>A DataSet with a single table of the provided name
included.</returns>
/// <example>
/// <code>
/// This is an example, blah blah...
///
/// </code>
/// </example>
public DataSet GetDataSetSP(string storedProc, SqlParameter[] sqlParams,
string tableName) {
some code blah balh blah....
}
 
S

Steve C. Orr [MVP, MCSD]

I think you want the XML commenting functionality of C#.
Unfortunately VB.NET doesn't have this yet, but the functionality is
included in VB2005 which is scheduled for release later this year.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top