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 want to use the same icon for my application (the one that shows up in the Start menu) and for each of the forms in my app (the ones that show up in the Taskbar). I added the icon to my project in the Project designer, but when I try to add it to the form via the SystemIcons.Application property the forms show a different icon.
Surely there must be a way to reuse my application icon in my forms-where did I go wrong?
- Confused in Conesus
Dear Confused,
You probably went wrong by not carefully reading the reference documentation. The topic for the SystemIcons.Application property states that it returns "An Icon object that contains the default application icon." Note the word "default" -what you are seeing is the default Application Icon that Visual Studio uses if you don’t specify your own.
There is no way to directly set a form’s Icon property to the Application Icon that you set in the Project Designer. You can, however, use a single icon for both your application and your forms by adding the icon as a resource, as described in the topic “How to: Add or Remove Resources.”
Once you’ve added it, in the Project Designer choose your icon from the drop-down list for “Application Icon.” To set the form icon for each form you would add the following code in each form’s Form_Load event:
Me.Icon = My.Resources.myReallyCoolIcon
The lesson learned here is: it pays to be resourceful!
- Doc D
Dear Doc Detective,
I have an application that I am going to be distributing commercially. To prevent piracy I want to use serial numbers in my Setup program, something like the Product Key that comes with most Microsoft installation discs.
I’ve gotten as far as adding a Customer Information form to my Setup project, and I found the topic describing the SerialNumberTemplate property, but I still don’t have a clue how to use it. Can you help?
--Clueless in Claremore
Dear Clueless,
The topic “SerialNumberTemplate Property” tells you everything you would ever want to know about the property-except how to use it! The Doc did some investigating and discovered that you can almost-but not quite-duplicate the Microsoft-style Product Key using this property.
Let’s start by looking at the anatomy of a Microsoft Product key and how it might be represented using the SerialNumberTemplate property. The key “CB48T - GGBCX - H269K - C9W64 - X2RWD” would be represented in the SerialNumberTemplate property as "”^^%#^ - ^^^^^ - ^%%%^ - ^%^%% - ^%^^^.”
Literals are used as notation for the property-the “^” characters represent placeholders for letters, the “#” character represents a number that is ignored, and the “%” character represents a number that will be evaluated by the validation algorithm. In this case, if you add together the numbers represented by “%” and ignore the number represented by “#” you get 42; dividing this by 7 leaves a remainder of 0 so the validation succeeds.
If you were to use this same template for your own Product Key, you would need to generate a series of keys to provide to your customers when you distribute your program, randomizing the placeholder characters and also randomizing the numbers, making sure that the numbers represented by “%” are divisible by 7.
There is one catch though-if you read the topic carefully, it says “A separate text box will be created each time the editable character is changed, for example, entering “#?%” creates three text boxes, each accepting one character.”
You can get around this by making just one of the groups contain the numbers that you will validate, and use the “?” character in all of the other fields: “????? - %%%%% - ????? - ????? - ?????”. You could still use a mix of numbers and letters in your keys, but the second group would always contain only numbers - for example, “BC45T - 340707 - 1XFFE - EFT22 - 1XYZ3.”
- Doctor D
Dear Doc Detective,
I started working with Visual Studio 2005 today. I came across a newly added drop down box in the Visual Studio IDE right next to the “Debug / Release” dropdown box. This new dropdown box lists options like “.NET,” “Any CPU,” “Mixed Platforms,” “Configuration Manager.” Any idea what these setting are for?
- Overwhelmed in Overton
Dear Overwhelmed,
The dropdown that you are referring to controls Solution-level build settings that allow you to target several different CPU architectures within a single solution. For example, you might need two different build configurations for an x64 and an x86 version of your app. What you see in the list depends on what you have set in the Configuration Manager dialog box.
The topic “How to: Configure Projects to Target Platforms” talks about configuring solutions to target multiple platforms.
Note that you may or may not see this dialog box in your IDE-it’s dependent on the profile that you chose when you first installed Visual Studio.
- the Doc
Doc’s Doc Tip of the Day
Have you ever wished you could add your own content to the Visual Studio doc, or add comments or corrections? Now you can, thanks to the new MSDN Wiki, now available in Beta form.
MSDN Wiki provides an infrastructure for users to comment, edit, and add content to the Visual Studio 2005 and .NET Framework 2.0 online documentation. The site includes the English version of the Visual Studio 2005 and .NET Framework 2.0 documentation. In addition, it includes versions of these topics that are machine-translated into Brazilian Portuguese.
The content comes from the same database used by MSDN, so the Microsoft content you see on the MSDN Wiki site is always current-with the added benefit of being able to see content added by the community.
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/en-us/library/3bka19x4(VS.80).aspx
http://msdn2.microsoft.com/en-us/library/w3xwh311.aspx