Finding what you need in the Microsoft® Visual Studio® 2005 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 need to save both application settings and user preferences between runs of my application. I see that Visual Basic has the new Settings object in the My namespace that makes this easy, but there doesn’t appear to be any similar object for C#.

Is there any way that I can use My.Settings from a C# project, or do I have to go the route of reading and writing registry settings?

- Envious in Englishtown

Dear Envious,

While it’s true that only Visual Basic has the My namespace, C# can indeed handle settings in much the same way as Visual Basic. The Properties namespace in C# exposes a Settings object, and settings can be entered at design time in the Settings tab of the Project designer.

To access settings at run time you would use code similar to the following:

This.label1.Text =
Properties.Settings.Default.SomeSettingString

The Visual Studio documentation doesn’t really cover this very well, however there is a recent article in the MSDN Library that explains it quite thoroughly. Look for the article “Using Settings in C#.”

Does that cure your case of VB envy?

- Doc D

Dear Doc Detective,

I’m creating a multi-lingual application and I need to get a list of Internet Explorer language preferences-the one from the Language Preferences dialog off of Internet Options. Are there any classes or methods in the .NET Framework that can help me do this, or if not, maybe some way to get this from the registry?

--Tongue-tied in Tonawanda

Dear Tongue,

You didn’t say what type of application you are creating, but there are a couple of options. If your code is running in IIS and your browser does an http request you can get the list of the languages from the HttpContext.Current.Request.UserLanguages property. This works for all browsers. The reference topic “HttpRequest.UserLanguages Property” has an example of this.

If you need to get the value from the registry on the client, try reading the HKCU/Software/Microsoft/Internet Explorer/International/AcceptLanguage registry key. I couldn’t find any documentation on this and I can’t confirm that it is the same for all versions of Internet Explorer, so you’re on your own.

You might also want to look at the AdventureWorks Cycles Storefront sample which demonstrates building a language sensitive Web app. You can read about this sample in the article “Readme_Storefront.”

- Doctor D

Dear Doc Detective,

There is no Shape control in Visual Basic Express as there was in VB 6. I need it to create a bar graph to be used as a volume-level indicator. How would I do this?

- Shapeless in Schenectady

Dear Shapeless,

While there isn’t a shape control in VB Express, there are a couple of ways to do what you want-you can use Label controls as replacements for rectangular shapes, or you can use graphics methods in your form’s Paint event to draw your own shapes. The topic “Shape Control for Visual Basic 6.0 Users” explains both methods

Working with graphics isn’t as hard as you might think-take a look at the Guided Tour topic “Drawing Pictures: Using Graphics” for some hands-on examples.

And stay tuned-the Doc is hearing rumors of replacements for the Shape and Line controls that should be available on the MSDN Visual Basic Developer Center’s Visual Basic 2005 Power Packs site by the time you are reading this.

- the Doc

Dear Doc Detective,

I want to use ClickOnce to deploy an application that uses some native DLLs. I want to include those DLLs in the Application Manifest. I figured that if I check “Show All Files” I would see all the files in the output directory (bin\debug or Release) and I would be able to include my native DLLs. But, that did not work. Is the only option to edit the project file manually or to create a Custom MSBuild script?

- Flustered in Florence

Dear Flustered,

ClickOnce isn’t that smart-it only includes known dependencies and build outputs, not all files in the output directory. If, however, you include the file in your project as “content” (set the BuildOutput property for the file to Content), ClickOnce will pick it up.

This is explained in the topic, “How to: Specify Which Files Are Published via ClickOnce”

Are you contented now?

- Doc D

Doc’s Doc Tip of the Day

This month, the Doc has a bunch of tips for using the Index to quickly find the right topic.

  • Use filters with the Index window to weed out index entries that don’t apply to you. For example, at the top of the Index window, in the Filtered by list, select “Visual Basic.”
  • If you do not find the entries you expect, try reversing the words you enter. For example, if “debugging inline assembly code” did not display any relevant entries, try typing, “assembly code, debugging inline.”
  • Scroll up and down the index entries. Not all topics are indexed the same way, and the one that could most help you might be higher or lower in the list than you expected.
  • Enter words as singular or partial string without endings. By entering a partial string, you can get to topics that have been indexed with search keywords that are singular or plural. For example, enter “propert” to start your search above properties and property.
  • Try entering gerund (-ing) forms of the verb for the task you want to complete. To find more specific index entries, append a word that describes exactly what you want. For example, type “running” to get more entries or “running programs” to get fewer.
  • Try entering standalone adjectives. To narrow the results, append a word that describes exactly what you want. For example, enter “COM+” to get a wide range of entries or “COM+ components” to get fewer.
  • Omit indefinite articles (such as “a”) because the Index window ignores them.

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

URLs

http://msdn.microsoft.com/vcsharp/default.aspx?pull=/library/en-us/dnvs05/html/SettingsCS_RL.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemWebHttpRequestClassUserLanguagesTopic.asp

http://msdn2.microsoft.com/en-us/library/ms160795.aspx

http://msdn2.microsoft.com/en-us/library/bbw12xs4.aspx

http://msdn2.microsoft.com/en-us/library/x7te38d7.aspx

http://msdn.microsoft.com/vbasic/downloads/powerpacks/default.aspx

http://msdn2.microsoft.com/en-us/library/kzy0fky2.aspx