Finding what you need in the Microsoft� Visual Studio� 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 docdetec@microsoft.com.

Dear Doc Detective,

I teach a class in basic web programming, so I was pretty excited to learn about WebMatrix, which seems perfect for my students. However, I was a little surprised to find that pretty much all the examples I can dig up are in C#. I see in WebMatrix itself that there is a CSHTML file and a VBHTML file. But I'm not seeing a lot of information about how to actually do things in Visual Basic. I always thought that Visual Basic was Microsoft's entry-level programming language - is that not true anymore?

  • Peeved in Peoria

Dear Peeved,

The Doc Detective posed your question to some of the people who developed WebMatrix and the Razor syntax, which is the programming syntax used for that product. They told me that they had thought long and hard about this before WebMatrix was released, and had decided to put C# front and center for two reasons. The first was that they thought it was distracting, at best, to have to not only learn the product, but then have to decide (probably based on no particular preference) between two programming languages. If they gave all languages equal weight, every sample would have to be in two languages (as in MSDN), so this choice would be in the user's face all the time. The thinking here is that this is not helpful for beginners. As for why they didn't choose Visual Basic automatically, the reasoning was that if there was just one language you might have been exposed to as a beginning web programmer, it was likely to have been JavaScript, which is, of course, a C-like language.

However, as you note, Visual Basic is an option. Although you won't find every example rewritten in Visual Basic, there is a great summary on the ASP.NET website of how to use Razor syntax in VBHTML pages. The hope is that this chapter will help you learn the basics of Razor syntax with a Visual Basic spin, and that you'll be able to make only minor adjustments to any examples that you encounter that are written in C#.

Happy “V[e]B” programming!

  • the Doc

Dear Doc Detective,

I need to write code that makes changes in Team Foundation Server (like updating tasks and bugs) under an impersonated identity. How do I do that?

– Blocked in Blacksburg

Dear Blocked,

When you connect to Team Foundation Server, you can use a method that supports impersonation to act on behalf of an identity other than the one that runs your application. Any operations that are performed based on that connection will be performed on behalf of the impersonated identity.

This is covered (and well-hidden) in the “Acting on Behalf of Another User” section of the topic “Connect to Team Foundation Server from a Console Application.” It does sound powerful - just think of all of the fun you could have impersonating a co-worker.

  • Doctor D

Dear Doc Detective,

The other day someone showed me a trick to invoke code snippets in the C# code editor. For example, typing “CW” then hitting Tab twice, it inserts the code snippet for Console.WriteLine.

I think this is totally cool, but where do I find a list of these shortcuts for other snippets?

  • Dumbfounded in Dublin

Dear Dumbfounded,

I hate to say it, but you appear to have stumped the Doc. I found the topic “How to: Insert IntelliSense Code Snippets” which clearly states “Type the shortcut for the code snippet that you want to add to your code.” However, there is no link to any list of shortcuts!

It also says that you can type the first few letters of the shortcut and then press either CTRL+SPACE (C#) or a question mark followed by the TAB key (VB) to view the completion list, and then select the snippet shortcut from the list. While this is helpful, it isn't nearly as nice as the two letter shortcut.

Note to writers: please don't tease us like this.

  • the Doc

Dear Doc Detective,

Why are my StringLength and other DataAnnotations attributes being ignored in an ASP.NET MVC app?

  • Irked in Irving

Dear Irked,

No snickering please… you probably have a naked partial class. To learn how to fix this, see “How to: Validate Model Data Using DataAnnotations Attributes” or “How to: Customize Data Field Validation in the Data Model Using Custom Attributes.”

And yes, it really is referred to as a “naked partial class.” If you don't believe me, go to Bing and search on “naked poco buddy” - it will return the first topic.

  • Doctor D

Doc's Doc Tip of the Day

Ever wonder what happens when you click the “Send Feedback” link in a Help topic and report a bug or make a suggestion? The Doc asked and here's what he found out.

Feedback bugs are immediately entered into a bug database and are reviewed several times a week. After making sure that they aren't spam, they are routed to the writer that owns the topic. The writer reviews the feedback, and may email you for additional information or clarification.

If they agree with the bug or suggestion, they fix the topic, and it gets published in the next monthly update. If you are using the offline docs, you can also get updated content through the Help Library Manager, available on the Visual Studio Help menu.

Found a topic in Help that doesn't help? Tell the Visual Studio documentation team about it by clicking on the “Send feedback” link in local Help topics, or the “Click to rate and give feedback” link in online Help.

URLs

http://www.microsoft.com/web/webmatrix/

http://www.asp.net/webmatrix/tutorials/asp-net-web-pages-visual-basic

http://msdn.microsoft.com/en-us/library/bb286958.aspx#impersonation

http://msdn.microsoft.com/en-us/library/ms165399.aspx

http://msdn.microsoft.com/en-us/library/ee256141.aspx

http://msdn.microsoft.com/en-us/library/cc668224.aspx