Skip to Main Content
Professional Visual Studio® 2008
book

Professional Visual Studio® 2008

by Nick Randolph, David Gardner
July 2008
Intermediate to advanced content levelIntermediate to advanced
1026 pages
27h 59m
English
Wrox
Content preview from Professional Visual Studio® 2008

40.2. Resourcing Your Application

Writing an application often requires data such as images, icons, or sounds (collectively known as resources) to enhance the appearance of the application. Furthermore, best coding practices suggest that the use of constant strings throughout your application be avoided. In either case we can put together a custom solution that stores these resources in files that need to be shipped with the application.

An alternative is to include them in a resource file that can be compiled into your application. This way you not only have the resources in a format that you can work with, but they are also automatically available within your application.

In Visual Studio 2008, forms are initially represented by two files: the generated designer file (for example, Form1.Designer.vb) and the code-beside file (for example, Form1.vb). When a control, such as a button, is first added to the form, a resource file (for example, Form1.resx) is automatically created for the form. By default, this resource file contains very little data, as most properties are hard-coded into the designer file. This file becomes very important when localization is turned on for the form. When this is done, via the properties grid shown in Figure 40-5, the designer properties for the controls on the form are persisted to the resource file.

Figure 40.5. Figure 40-5

The following code ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Professional Visual Studio® 2010

Professional Visual Studio® 2010

Nick Randolph, David Gardner, Michael Minutillo, Chris Anderson

Publisher Resources

ISBN: 9780470229880Purchase book