Finding what you need in the Microsoft® Visual Studio® .NET documentation, which has over 45,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,
In Visual Basic 6.0 I could use the Format function to return a date formatted the way I want it. For example, the code
TextBox1.Text = Format("01-01-2001",
"dd MMM yyyy")
returned "01 JAN 2001". When I try the same code in Visual Basic 2005, I get the string "dd MMM yyyy" instead of the date-what's up with that?
- Dateless in Danville
Dear Dateless,
Visual Basic .NET handles the formatting of dates differently than Visual Basic 6.0. You can use the FormatDateTime function to return a date using one of five pre-defined formats?unfortunately the format that you want isn't one of them.
You can, however, use the VB6.Format function from the Microsoft.VisualBasic.Compatibility namespace, which works exactly like the Visual Basic 6.0 Format function.
TextBox1.Text = VB6.Format("01-01-2001", "dd
MMM yyyy")
Although the Compatibility namespace was originally intended as a helper for upgrading applications, it contains many useful functions that allow you to continue to write code using Visual Basic 6.0 syntax. Although the namespace isn't documented, the topic "VisualBasic.Compatibility Namespace Reference" lists some of the more common functions.
- Doc D
Dear Doc Detective,
The documentation part of the Visual Studio 2005 Beta 2 install has a rather large footprint. Can I save some disk space by just not installing the documentation and accessing it online instead? For example, is there something in one that is not in the other? It sounds like the online version might even be more up to date.
--Frugal in Fresno
Dear Frugal,
Visual Studio 2005 offers all MSDN documentation online, so you don't have to install any documentation locally in order to use the Help system. You are correct that there will generally be fresher, more up-to-date content online. New topics will be added to the Online Help store that won't be available locally unless you install quarterly MSDN updates.
One important difference to be aware of is that you won't be able to use the local Index or Table of Contents features of Visual Studio unless you have content installed locally. However, you can see the online Table of Contents by clicking "show toc" in topics retrieved from MSDN Online via Search or F1.
Another option to save disk space is to do a partial MSDN install. This will allow you to choose which chunks of content you'd like to install, rather than installing all of MSDN. With this option, you'll have your key content installed locally, and you'll also search MSDN Online in parallel. F1 will also go out and get an online article when a relevant article isn't found locally.
- Doctor D
Dear Doc Detective,
Is it possible to use a logarithm in Visual Basic Express? When I try to use the Log function I get the error "Name 'Log' is not declared."
F = Int(Log(Dec) / Log(2))
- Waterlogged in Waterloo
Dear Waterlogged,
The reason you are getting an error is because Visual Basic has two Log methods-one in the Math namespace, and another in the Debugger namespace. You need to tell it which Log method to use, either by adding an Import statement for the System.Math namespace, or by using the namespace in code.
F = Int(Math.Log(Dec) / Math.Log(2))
To learn more about the Math namespace, see the topic "Math Members (System)".
- the Doc
Doc's Doc Tip(s) of the Day
If you've been using the Visual Studio 2005 Beta 2 documentation, you may have noticed that the filtering mechanism has changed. There are now three different filters: one which defines what appears in the index and table of contents, another which defines what appears when you perform a search, and another that determines which code appears in topics.
The Index and Content filters are selected from a predefined list that allows you to filter by language (Visual Basic, Visual C#) or by technology (Web, Windows Forms). This is especially helpful when you are working on a Windows application and you don't want to see topics related to Web controls.
The Search filter is even more versatile, allowing you to search based on a combination of language, technology, and topic type. You can also change the settings in Tools, Options to search locally or online, or both.
The Language filter allows you to control which languages are displayed in Help topics-if you never use Visual J#, you can uncheck it and you will no longer see J# code displayed.
Found a topic in Help that doesn't help? Tell the Visual Studio documentation team about it at vsdocs@microsoft.com.
URLs
http://msdn2.microsoft.com/library/default.aspx
http://msdn2.microsoft.com/library/99hzz941(en-us,vs.80).aspx