.net resource files question...

C

craig

....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 resource file and then have all the
forms in all assemblies refer to it for image information? Is there a
better approach?

Any help or a point in the right direction is appreciated!!

Thanks!!
 
M

Miro

I am just switching all my forms to use a resource file. That is my
intention too.

I have not had to do any swapping yet...but i had too many imaglists with
teh same pictures on multiple forms.
So I am in the midst of going along the same approach.

If the swapping doest go smoothly...I still thing this is the better
approach...as I only have to change the image in 1 spot rather than
mulitple.

( vb 2005 ) express

I created a resource file by adding a new item, and then a text file..but
rename the file to bla.resx and it will be turned instantly into your own
resource.

Miro
 
C

craig

Good to see that others consider this to be a reasonable approach. Yes, I
have the same issue....the same images in image lists on many different
forms, which is very inefficient.

I am hoping to learn if there is a way to include a single resource file in
the main assembly and then have all the other assemblies reference it. Not
sure how to do that yet.
 
M

Miro

Go into the microsoft.public.dotnet.languages.vb newsgroup.

Search for subject "New Resource"
here is the quote from Armin Zingler that he gave me...and so far it has
worked perfectly.
Menu Project -> Add new item -> Select "text file" and change the file
name to myicons.resx -> Ok. The resource editor will open.

I am not sure if the swapping of the icons is possible inside... but i have
all my icons / pictures / everything in one resource file for the whole
program.
I think its way easier to maintain.

I beleive ( but not sure ) ... if you set your resource file to be a
reference and so its not compiled ( somehow ) into your program, you can
"link" to the files instead of imbedding them.

But at least were 70% there :) Thats as far as I can help you so far.
Sorry

Miro
 
M

Miro

I might use that link, right now I just drag drop into my resource. But I
think that will come in handy when I want to create an external file.

This might help....

If you look at the generated code,

'Here is how my image is linked to my resource file for my "Home" button
where Home_Dark is a png file ( gif / jpg )
Me.bHome.Image = Global.MyProject.My.Resources.PicturesIcons.Home_Dark

If you look at a resx file, there is an Build Action. I think once you
change this... then thats how you link it so it doesnt imbed the image in
the exe until it compiles it each time or something.


Miro
 
C

craig

Yes....that is helpful!

I was wondering how to reference the resource file from other projects. I
wonder if this works in C#.

Thanks!
 
M

Miro

One more thing:
It also lets you IMPORT the resource at teh top of the code too like any
other import.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top