With over 45,000 topics, finding what you need in the Visual Studio .NET documentation can be a daunting task. The Doc Detective is here to help, utilizing his investigative skills to probe the depths of the documentation.

The Doc Detective

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 like this new Console project type that's available in Visual Studio .NET. I'm working on a utility program that parses text files. I want to replace my text prompts with command line switches. How do I program that, and how do I send the switches to the program when I press F5? Here's an example of my command line:

parsefile filename.txt fast verbose.

Please help!

--Inconsolable in Indianapolis

Dear Inconsolable,

You have several options for grabbing that extra text; I'll show you two. If you don't expect any of the arguments to be enclosed in quotes (like "My Documents"), then I suggest the Command function that is part of the Visual Basic runtime. That command puts everything that follows the program name into a string. You can use the String.Split function to break out the individual words into an array of strings. Your Main function would look like this:

Sub Main()
    Dim switchLine As String = Command()
    Dim switches() As String =
       switchLine.Split(" ")
    ' Now use the switches
End Sub

Unfortunately, the method above would break "My Documents" into two strings, "My" and "Documents." To prevent this, you can use the .NET Framework System.Environment.GetCommandLineArgs method to retrieve the line. The following method also retrieves the program name.

Sub Main()
    Dim switches() As String
    switches =
    ' Now use the switches
End Sub

To specify the arguments used when you press F5, open the Project Properties dialog box by right-clicking the project in Solution Explorer and then choose Properties. Select the Debugging page of the Configuration Properties, and then set the Command line arguments property.

For a discussion of these and other command line options, look for the topics, "The Visual Basic Version of Hello World!" and "Structure of a Visual Basic Program." Hopefully this will put you back in command.

-- The Doctor

Dear Doc Detective,

After programming in Visual Basic for many years, I've just moved to the .NET Framework. In earlier versions of Visual Basic I could change the alignment of text in a Textbox or Label using the alignment constants VbLeftJustify, VbRightJustify, or VbCenter. I can't seem to find the equivalents in the .NET Framework?in fact, looking at the index I can't find anything useful regarding constants or alignment.

-- Confused in Constantinople

Dear Confused,

As you've noticed, even constants aren't necessarily constant. In Visual Basic .NET, "constants" are now called "enumerations." In the case of the alignment constants, Windows Forms allow greater control over formatting. In addition to setting horizontal justification, many controls allow you to set the vertical justification as well. Hence VbRightJustify becomes HorizontalAlignment.Right for the TextBox control, and ContentAlignment.TopRight for the Label control. For a quick reference of the Visual Basic 6 alignment constants and their .NET Framework equivalents, look for the topic "Alignment Constant Changes in Visual Basic .NET." In fact, there are similar topics for all of the VB6 constants?just look for the Doc's favorite topic title, "Constant Changes in Visual Basic .NET."

-- Doctor D

Dear Doc Detective,

After upgrading my operating system, I had to reinstall Visual Studio .NET and the MSDN Library documentation. The development environment works fine, but the documentation seems to be corrupted in some way. When I use the Index, all items that appear in the Index Results window are shown as having a title of "a," rather than a real title of the Help topic. Can I fix this?

-- Helpless in Helsinki

Dear Helpless,

This is by design. All of our Help topics have been re-titled "a" to make sure that search always returns 500 hits. Okay, just kidding?this is easily fixed. You just need to re-register a DLL file: hxds.dll. There's a tool that comes with Visual Studio .NET named Regsvr32.exe that you can use to re-register the DLL. Open a command prompt, type regsvr32, a space, and the path and file name of the DLL. For more information, the Platform SDK has a topic named "Register Server" that you can look up in the Index using the keyword "regsvr32."

-- The Doc

Doc's Doc Tip of the Day

One of the biggest requests that the Doctor gets from Visual Basic programmers is that you want more code examples?as Sergeant Friday would say, "Just the code, ma'am." Well, this month the Doc has some good news for you! As of April, the MSDN Online Library has been updated with the documentation for Visual Studio .NET 2003. Included in the updated documentation are over 150 new "code snippet" topics covering the most requested code examples. These topics aren't long on explanations, they just provide you with code that you can cut and paste into your application. Even if you aren't using Visual Studio .NET 2003 yet, you can still use the code. For a complete list of the new code example topics, just look for "Visual Basic Code Example Topics" in the MSDN Online Library. These updated topics are also available in your April 2003 MSDN subscription.

Found the topic in the docs, but it doesn't answer your question? Tell the Visual Studio documentation team about it at vsdocs@microsoft.com.