Home All Groups Group Topic Archive Search About
Author
3 Nov 2006 8:46 PM
TCook
Hey All,

I'm trying to add a resource file to my app but it's not working.

I have done the following:

-- Added a .resx file
-- Added some strings
-- Named the file "MyStrings.en.resx"
-- Add the file as a resource to the "Project" > "Properties" > "Resources"
-- Tried to call the strings using:
Dim rm As ResourceManager
rm = New ResourceManager("StringTable", Me.GetType().Assembly)
MessageBox.Show(rm.GetString("String1"))

Clearly I'm missing something.  How do these .resx files need to be added in
order to work properly?

I've looked at the documentation online and I don't see it.

Please advise.

Thanks,

TC

Author
3 Nov 2006 11:39 PM
Herfried K. Wagner [MVP]
Show quote Hide quote
"TCook" <getmyemai***@yahoo.com> schrieb:
> I'm trying to add a resource file to my app but it's not working.
>
> I have done the following:
>
> -- Added a .resx file
> -- Added some strings
> -- Named the file "MyStrings.en.resx"
> -- Add the file as a resource to the "Project" > "Properties" >
> "Resources"
> -- Tried to call the strings using:
> Dim rm As ResourceManager
> rm = New ResourceManager("StringTable", Me.GetType().Assembly)
> MessageBox.Show(rm.GetString("String1"))


Why aren't you using 'My.Resources.*'?

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://dotnet.mvps.org/dotnet/faqs/>
Author
4 Nov 2006 3:41 AM
TCook
Hey Herfried,

Thanks for the info.  Now I see!

I added the strings under the project properties and Voila!, I could call
the data in code via intellisense.

However, the above said, what about all of this stuff:



Dim rm As ResourceManager
rm = New ResourceManager("StringTable", Me.GetType().Assembly)

    Message = New StringBuilder()
    Message.Append(rm.GetString("String1"))
    Message.Append(rm.GetString("String2"))


Where does code like the above come into play?

Regards,

TC



Show quoteHide quote
"Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message
news:uIsQJF6$GHA.3536@TK2MSFTNGP03.phx.gbl...
> "TCook" <getmyemai***@yahoo.com> schrieb:
>> I'm trying to add a resource file to my app but it's not working.
>>
>> I have done the following:
>>
>> -- Added a .resx file
>> -- Added some strings
>> -- Named the file "MyStrings.en.resx"
>> -- Add the file as a resource to the "Project" > "Properties" >
>> "Resources"
>> -- Tried to call the strings using:
>> Dim rm As ResourceManager
>> rm = New ResourceManager("StringTable", Me.GetType().Assembly)
>> MessageBox.Show(rm.GetString("String1"))
>
>
> Why aren't you using 'My.Resources.*'?
>
> --
> M S   Herfried K. Wagner
> M V P  <URL:http://dotnet.mvps.org/>
> V B   <URL:http://dotnet.mvps.org/dotnet/faqs/>