Finding what you need in the Microsoft® Visual Studio® 2008 documentation, which has over 200,000 topics, can be a daunting task. The Doc Detective is here to help, utilizing his 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

Dear Doc Detective,

I heard somewhere that the new LINQ capabilities in Visual Studio 2008 allow you to directly query a DataSet. I launched Visual Studio, created a DataSet in the code:


and tried to use LINQ to query it. I was never able to figure out any syntax that worked.

Is it a misnomer to call this feature “LINQ to DataSets” or can one really use LINQ to query a simple ADO DataSet?

- Linqless in Lincoln

Dear Linqless,

Perhaps it is a bit of a misnomer to call it “LINQ to DataSets” and that is likely the source of your frustration. In reality, the feature allows you to query a table within a DataSet (or multiple tables if you use the Join or GroupJoin query operators), not the DataSet itself.

For those of you who have been living under a rock, LINQ, or language integrated query, is a set of features in Visual Studio 2008 that extends powerful query capabilities to the language syntax of C# and Visual Basic. LINQ introduces standard, easily-learned patterns for querying and updating data, and you can extend the technology to support potentially any kind of data store.

To learn more about LINQ to DataSets, start with the topic “LINQ to DataSet Overview” in the MSDN Library. Read it, and LINQ to your heart’s delight.

- Doc D

Dear Doc Detective,

I inherited some VBA code that performs custom actions in a Word document. I am using Visual Studio Tools for Office to update the code, and I have run into a problem. After adding code and running the project, the next time I run it all of my changes are gone. Why does it do this, and how can I save my code?

- Broken in Brooklyn

Dear Broken,

The behavior that you are seeing is similar to the behavior of local databases in Visual Studio. As with local data, there are multiple copies of the document where you can add VBA code that calls into the Visual Studio Tools for Office customization.

As you develop and test your solution, you can write VBA code in the document that opens while you debug or run your project in Visual Studio (that is, the document in the build output folder). However, any VBA code you add to this document will be overwritten the next time that you build the project, because Visual Studio replaces the document in the build output folder with a copy of the document from the main project folder.

If you want to save the VBA code that you add to the document while debugging or running the solution, copy the VBA code into the document in the project folder.

You can find this covered in the topic “Calling Code in Document-Level Customizations from VBA“; you might also want to look at the topic “Walkthrough: Calling Code from VBA in a Visual Basic Project.”

- Doctor D

Dear Doc Detective,

I’m looking for a Windows Forms control similar to the Repeater control in Web forms, one that allows you to repeat a custom layout for each record in a database. I remember such a control for Visual Basic 6, but I can’t find one for Windows Forms.

Is there something like this in Visual Studio 2008 that I’m just not finding, or if not, do you know of a similar control from a third-party source?

- Searching in Seattle

Dear Searching,

Your timing is impeccable! Microsoft recently released version 3.0 of the Visual Basic Power Packs which includes a DataRepeater control that should fit the bill. You can simply drag and drop controls from the DataSources window onto a template. You can arrange the controls as you wish and even add unbound controls, and the layout is repeated in a scrolling list at run time.

You can download the Power Packs for free from the Visual Basic Developer Center on MSDN. By the way, the Doc has it on good authority that these controls will also be included in a future update to Visual Studio. And if you are a C# developer with VB-envy, don’t worry-it may say “Visual Basic” but you can use it in any Windows Forms application.

- Doc D

Dear Doc Detective

In an earlier column, “Overwhelmed in Oakland” asked how to restrict an application to a single instance per user. You pointed to the topic “How to: Specify Instancing Behavior for an Application” in the MSDN Library.

Having learned this the hard way, I can assure you that the IsSingleInstance property of Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase controls application behavior on a single instance per machine basis-not a per user basis. Since that’s the property managed by the “Make single instance application” checkbox, the question you’ve answered is not really the question which “Overwhelmed in Oakland” was asking.

- Underwhelmed in Uncasville

Dear Underwhelmed,

You are correct... sort of. In most cases, there is really no difference between per user and per machine, since only one user can be logged on at a time.

If, however, your application is running in a multi-user environment such as a Windows Terminal Services environment, there can be a problem. Even if your running application is marked as single instance, it won’t be detected when a user in a different session tries to launch it.

This fact is not mentioned in the topic, and the Doc was unable to find any documentation on how to work around this limitation. If “Overwhelmed” was truly asking about single-instancing in a Terminal Server environment, then I sincerely apologize for steering him wrong.

- the Doc

Doc’s Doc Tip of the Day

Since last July the MSDN Library has encouraged tagging. No, not the spray-painting graffiti type of tagging, but the ability to add tags to MSDN online content.

Tags are essentially keywords or labels added to a Web page that are intended to describe the contents of the page. For MSDN, tagging helps surface content that might not be easily discovered-for example, newly added Community content. The implementation is unique in that the tags are wikified, meaning they can be added and/or removed by any and all users in the community.

To use tags that others have entered, go to the “browse by tags” page and click on any tag to narrow your search. As you browse the library, feel free to add tags that will help the next person find the content that you worked so hard to uncover.

Found a topic in Help that doesn’t help? Tell the Visual Studio documentation team about it at