Using resource files in .NET
I'm trying to use a resource file (.res) I created when working with VB6. I googled a bit, and found some code examples. But I keep getting the following error:
Code:
System.Resources.MissingManifestResourceException:
Could not find any resources appropriate for the specified culture (or the neutral culture) in the given assembly.
Make sure "Cards01.data.resources" was correctly embedded or linked into assembly "Cards01".
Cards01 is my project name, Data is the name of the .res file.
The code is as following:
Code:
resourceManager = New ResourceManager("Cards01.data", System.Reflection.Assembly.GetExecutingAssembly)
Code:
picStatus.Image = resourceManager.GetObject("601.bmp")
Basicly the program can't find the damn thing. But I tried all sorts of different syntaxes for parameters, with and without extensions. (eg. "Cards01.data.res", "data.res", "data")
The .res file is added to my project by clicking on "add existing item..."
Can anybody see what I'm doing wrong?
Re: Using resource files in .NET
In .NET res files are xml files which contain the resources so I don't believe you can use the .NET ResourceManager to read other application or previous versions resource files which were in a different format. You would need to write a custom reader for that format. If you did create the resource file in .NET then I misunderstood something.
Re: Using resource files in .NET
What you may want to do is write a small vb6 program to extract the resource images in your res file. Then take those images
and add them to your vb.net solution as Embedded Resource files.
Re: Using resource files in .NET
Well that certainly didn't occur to me.
When doubleclicking on the resource file in the solution explorer, it simply opens the 'tree' with files. So I figured it was still compatible.
I didn't create the .res file by writing code in vb6 (if that was even possible), but simply by creating a .res file and adding all the pictures manually. Is that still possible in .NET?
I certainly can't find the right menu option (the fact that I don't remember how I did it in vb6 doesn't help either)
The resources file is meant to hold about 50 .bmp files, so nothing fancy.
edit: I found out there was a tool in the SDK samples I could use. The "Resource Editor".