473,770 Members | 1,787 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to use Resource files in VS 2005?

Tom
This may seem a little strange, but in all my years of developing Windows
Forms apps, I've never really used Resource files; however, I would like
to start doing so in order to store icons, pictures, and most importantly,
error message strings in resource files so I don't have to go searching for
them inside the code (if I want them changed).

I know VS 2005 makes it MUCH easier to use and create resource files, but
in my few times I have tried I ended up not doing things right. Therefore,
does anyone know of any articles, tutorials, etc on how to createm use, and
ACCESS resource files (and items in them) in VS 2005? I am sure it is not
hard but a tutorial or something would go a long way in helping out.

Thanks a bunch.

Tom
Aug 31 '06 #1
1 2007
Well, it depends on what you want to do with it. I wasn't able to find
many good tutorials, but here is kinda what we use.

Go to 'add new item' and choose resource file, name it
MyResources.res x. VS will generate some code for this, but there are
ways to load the resource manager by hand. You can 'show all files'
on the project, and then look at the code it generates for the .resx
file to see how some of this works.

To get at a resource : MyResources.MyR esources.res_na me (returns
string/icon/etc)
To get the manager : MyResources.MyR esources.Resour ceManager

Loading it dynamically is a little harder, but not too bad. You just
have to know what assembly it is in, mostly. I wrote a utility class
that sits in the same dll as the resources, so I get my manager by
calling :

Dim resMgr as New ResourceManager (
GetType(IconRes ources.IconReso urces).Name,
Assembly.GetExe cutingAssembly
)
// you could also use GetType(...).As sembly there.

After that you can call GetObject/GetResource on it, wrap it up with
nice functions, etc. Do this is if you need to have someone specify
which resource manager to return by name, not type. Also, look in the
code for the resx to see another way of loading the manager

So far it works pretty well for me. I can not get access to this
resource file from another dll (in designer mode) but it works great
for all my dynamic stuff.

HTH

Tom wrote:
This may seem a little strange, but in all my years of developing Windows
Forms apps, I've never really used Resource files; however, I would like
to start doing so in order to store icons, pictures, and most importantly,
error message strings in resource files so I don't have to go searching for
them inside the code (if I want them changed).

I know VS 2005 makes it MUCH easier to use and create resource files, but
in my few times I have tried I ended up not doing things right. Therefore,
does anyone know of any articles, tutorials, etc on how to createm use, and
ACCESS resource files (and items in them) in VS 2005? I am sure it is not
hard but a tutorial or something would go a long way in helping out.

Thanks a bunch.

Tom
Aug 31 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
1301
by: Jack Russell | last post by:
I am looking at "internationalising" a project. I can understand resource files, creating them etc. However the drawback with them seems to be you need to use Visual Studio to create and maintain them. It is easy for me to create a text file containing all of the controls and their strings. I can then give this to a "non computer " person i.e. an end user to produce a foreign language version. I then read that in.
1
2843
by: herbert | last post by:
In VS.2005 there are three templates for storing application info: Resource File Settings File Application File. 1) What is the purpose of each one? When to use, when not? 2) How does VB's My.Setting map to these files? 3) Can a C# application access data written by VB's My.Setting ? 4) How does the ConfigurationManager class map to these files and is it relevant to VB.Net coders?
3
249
by: Larry Gillstrom | last post by:
Hi Our company is trying to migrate all of our products developed in msvc 6 to msvc 2005. Everything was going smoothly until we discovered that msvc 2005 will not save any changes we make in our resource (rc) files. And if we do make a change in the resource file, msvc 2005 crashes on exit. I noticed someone else reported this bug a few weeks ago, does anyone know if there is a decent workaround for this?
7
3467
by: Rich | last post by:
I am resurrecting this question (since it got bumped down by more recent posts). This is probably very simple - I need to add a version resource to a DLL project in MSVC++ 2005 Express in order to have version info, copyright, etc. when checking the DLL file properties from Windows Explorer. Any guidance is appreciated.
7
2107
by: craig | last post by:
....quick question for anyone who might have some experience with .net resource files in VS 2003. I have an application that is not localized, but I would still like to be able to place all of the images that are used for icons across all of the forms in all of the assemblies in a single resource file so that swaping out an image in the resource file affects all localtions that it appears in the app. Is there a way to create a single...
2
3523
by: Andrus | last post by:
I have resource files in different languages created by VCS 2005 Express. I want to use those files to translate reports at runtime. I have text to be translated as string. I think I need to search resource file for this string id. After that I need to return translated string from other resouce file ? Is this best idea? Where to find sample code which implements this ?
0
1990
by: =?Utf-8?B?UGF1bCBIYWdlcg==?= | last post by:
I've been trying to solve this issue for the better part of a month. My attempts to get an answer on the MSDN groups proved to no avail. Here is the situation/problem. I am migrating an old piece of software developed using VC++ 4.2, running on Windows NT 3.51 to VC++ 2005, running on Windows XP Pro SP2. I went through all of the necessary gyrations to reach the point where all of the deprecated functions were dealt with. I got a...
1
6999
by: TisMe | last post by:
Hi All, I am trying to use resource files to globalize my website application. I had this working fine, working through the API for setting page titles programatically, with the resource files in /resources I then started to add declarative code to the web forms to controls such as buttons and labels, as follows: <asp:Label ID="lblHowFindOut" runat="server" Text="<%$ Resources:how_did_you_find_out_about_this_site %>" />
7
2496
by: Ivan | last post by:
Hello group. Here is what I like to do. #1. Add ".SQL" file to project #2. Being able to load contents of this file into string variable. So, I want .SQL to be compiled into executable and being able to retreive contents for use inside program.
0
9454
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10257
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10099
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10037
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7456
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6710
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5354
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2849
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.