There are several ways to go about using a RES file in
vb.
The way that I do typically do it is to create an RC file (that is, a text file that with the extension of rc) and then compile that into a RES file using the rc.exe utility that comes with Visual Studio 6 (and probably with VB6 as well if that is all you got).
The compiled .res file can then be added to your project, and you can access the strings in the res file using the LoadResString intrinsic VB6 function like this:
Debug.Print LoadResString(1)
Another way to deal with this is to use the VB6 Resource Editor add-in, which you should be able to add to your IDE using the Add-In Manager. This tool lets you create and edit a res file for your project directly without using an rc file. This is perhaps a bit easier than making the .rc text file and then compiling it to an .res file, but it is also less flexible.
Because I have to deal with numerous languages and a lot of various translations, I do not include the res file directly in my main application, but rather compile it into an external dll which can then be used by the main application. This allows me to have more than one res file available to the application, since in
VB a project can have only one RES file directly associated with it, and allows me to change languages on the fly, so to speak. Another advantage to the method I use is that I can send the text file to a customer so they can create their own translations using any text editor.
The format of the rc file is important, and here is an example of a simple rc file:
// String Table for US English
STRINGTABLE DISCARDABLE
BEGIN
// Menu Items
100,"&Note"
101,"&New Note"
102,"&Edit Note"
103,"&Delete Note"
End
As a side note, remember that the maximum ID that a resource can have is 65535. That is plenty of strings for almost any app, and you can compile as many strings as you need into external dlls as I described above if you have such a need.
One thing I usually do is create an enum to map the resource ids. This way my code will have the human readable enum value instead of just "magic" numbers in the code. Make sense?
Anyway - there is more to this than can be quickly explained here, but this is a start for you.
Woody Z
http://www.learntoprogramnow.com