Finding what you need in the Microsoft® Visual Studio® 2005 documentation, which has over 200,000 topics (and to which my answers will refer), can be a daunting task. The Doc Detective is here to help, utilizing my investigative skills to probe the depths of the documentation.

Can’t find what you’re looking for? Just ask-if it’s in there, I’ll find it for you; if it isn’t, I’ll let you know that as well (and tell you where else you might go to find it).

Have a question for the Doc? Send your questions for future columns to me at docdetec@microsoft.com.

Dear Doc Detective,

This one has me stumped. I'm using a DataGridView control to display a table of product information, which is working fine. My problem is that I need display titles for both the columns and the rows.

I was able to set the header text for the columns and make the headers visible, but I can't see any way to do this for rows. Is this even possible?

-Headerless in Healdsburg

Dear Headerless,

Yes, it's possible-but it kind of depends on how you are using the DataGridView. You didn't say whether the DataGridView is databound or which data display mode you are using.

If you are in unbound mode, you can simply add a column on the left-hand side to display the row headers, and format it to look like your column headers.

In bound mode, the DataGridView control allows you to add an unbound column; virtual mode gives you total control over what is displayed but is more difficult to implement.

The topic "Data Display Modes in the Windows Forms DataGridView Control" provides a good overview of the subject and should get you "headered" in the right direction.

-Doc D

Dear Doc Detective,

I have an application that needs to run at a particular screen resolution-1024 x 768-in order to fit the main form on screen. How do I detect the user’s current screen resolution and then change it if necessary?

-Lost in Lodi

Dear Lost,

You can get the current screen resolution via the read-only Bounds property of the new My.Computer.Screen object. The topic "My.Computer.Screen Property" provides an introduction to this.

As for changing the resolution, it's not a good practice to programmatically change a user’s display settings-you should instead display a message to the user asking him or her to change the screen resolution themselves. If your application requires a particular resolution, you can cancel the application load until they have changed it to the required setting.

-Doctor D

Dear Doc Detective,

I've created a useful application that I hope to sell to others, but I'm concerned about piracy. How can I protect the program so that only the people I authorize can use it? How is licensing implemented? How do I create a product key like the ones you see in many Microsoft products?

-Penniless in Petaluma

Dear Penniless,

You are full of questions, aren't you? Piracy certainly is a concern for anyone selling software, whether it is shareware or an off-the-shelf mega-app. There are a couple of options for protecting your application depending on how you plan to distribute it.

For shareware applications, you might want to take a look at the free Shareware Starter Kit available on the MSDN download site. It includes code for product activation and registration using Web services-you can review the code to see how it works, and then "borrow" what you need for your own program.

For applications installed via Windows Installer setups, you can create a Microsoft-style product key in your Visual Studio Setup and Deployment project. You do this in the Customer Information User Interface dialog box that is displayed during installation by setting the ShowSerialNumber property to True and specifying a SerialNumberTemplate that is used to validate the serial number.

The topic "SerialNumberTemplate Property" explains how validation works. Whichever method you decide to use, here's hoping that your application becomes a best-seller!

-The Doc

Dear Doc Detective,

I'm using Crystal Reports to generate a series of reports from a SQL database. I have the code for displaying the reports in my application working fine, but now I need to add code to send the reports via e-mail from within my application. Any ideas?

-Frazzled in Fremont

Dear Frazzled,

The Doc doesn't know a lot about Crystal Reports, but after digging around, it appears that you would first need to export the report to a format that can be sent via e-mail. The Crystal Report docs include the topic "Tutorial: Exporting to Multiple Formats" that shows how to export the report in various different formats such as RTF, HTML, or Word.

Once you have exported it, you can send it as an e-mail attachment. The reference topic "AttachmentCollection Class" contains a code example that shows how to programmatically create and send an e-mail message with an attachment. I hope that makes it Crystal clear.

-D Detective

Doc’s Doc Tip of the Day

Tired of searching the docs for something and having to sift through 500 irrelevant results? You can create more targeted searches that return only those topics you are interested in by understanding how Help interprets the formatting you use in Help queries.

Some search tips:

Search subjects are not case-sensitive. For example, "OLE" and "ole" return the same results.

Logical operators (like AND, OR, NEAR, and so on) must be typed in all capital letters for search to recognize them.

You cannot search certain reserved words, such as and, for, from, and with. If these values are included in a search query, they are ignored. For a complete list, see the topic "Full-Text Search Tips".

Search queries are evaluated from left to right.

The period (.), colon (:), semicolon (;), comma (,), and hyphen (-) are ignored in searches. You cannot search for quotation marks.

Wildcard characters, such as * or ?, are no longer supported in Help searches.

Use quotation marks to search for an exact phrase. For example, enter "class definition" to search for topics that include the literal phrase "class definition". Without quotation marks, the search is equivalent to specifying "class AND definition", which returns topics that contain both of the individual words.

Use logical operators to specify the relationship between words in your search phrase. You can include logical operators, such as AND, OR, NOT, THRU, and NEAR, to further refine your search. For example, if you search for "declaring NEAR union", search results will display topics that contain the words "declaring" and "union" no more than eight words apart from each other.

You can further restrict the information returned by a search using filters. Help includes three different categories that you can filter by in a full-text search: language, technology, and topic type. Using one or all of these categories further refines your search results.

Found a topic in Help that doesn't help? Tell the Visual Studio documentation team about it at vsdocs@microsoft.com.