hi, i have a question about using resources in vb.net
is it possible to use traditional resources (.rc or .res) as opposed to the new .resX resources? I have to store custom binary resource types, and i do not know how to do this in .resX.
Click Add New Item... Resource Template > Name it and click Open.
Then right click the folder rct file in the IDE resource tab and select Add Resource. Then click Custom.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
i tried to do that because that is how it was done in the old version of C++, but i cannot figure out how to build a .res file with that or how to add it to a project so it will compile into the same .exe file. i looked through the help files but those didn't help.
also be advised that in .NET you can simply add items to your project like icons, bitmaps, textfiles, etc... and have them compile right into the exe. This is done by setting the build mode for the item you add to embedded resource. You can then extract them via code to use in your app. If you have a lot of items to go in the resource file, then you should still use one as it would be easier to manage, but if it is only a few files, then this may be a better bet. I just wanted to let you know since VB6 had no ability like this.
Kleinma, I was under the assumption that these custom resources were not able to be added the usual way.
Turns out there is a commandline switch and syntax for adding multiple resources in a single batch.
robdog - i realized cfresgen was in the 'compactframeworksdk' directory, so i assumed i was supposed to use 'resgen' in the normal sdk folder. i added my .rc file, and in the properties for it, set the Build Action to 'Embedded Resource', and set Custom Tool to 'resgen.exe resources.rc resources.res' and this did not work. I also set Custom Tool to blank and this did not work either. Should I have set the Namespace to something?
Also, I would be able to use a ResX resource if I could load a byte array from it and update it easily. All I can figure out how to write is a String, though. Either approach would work for me, but I will be updating the binary resources often.
AFAIK, the NameSpace and Custom Tool should be blank.
Did it error or ??? Did it create a .resources file?
I came across the Assembly Linker (Al.exe) utility that generates a file with an assembly manifest from one or more
files that are either modules or resource files. This is what places the resource file into an exe. Im not sure
on the exact parameters you need but its worth a look.
VB Code:
Al.exe /embed[resource]:file[,name[, private]]
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
robdog - don't worry, my delays are worse, my life has so much stress
anyway, when i set the option for 'resources.rct' to Embedded Resource, i get no errors, but i get no output file either.
since the old resource files don't seem to be supported anymore, i decided to give up on these. i think it might be easier to use resX files, since these are supported directly from .NET. Can you show me how to add a byte array to a .resX file?
Unfortunatly I dont know how to add byte arrays.
I havent had the need to yet. I only know the usualy resource items. I dont think you mean like in the resource
template where you can type in the hex data for the resource?
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
yes that's what i mean - i have a MIDI file i need to import and play, and I already have code that interprets that data from a StreamReader, i just need to get the data somehow.