I have a class in a VB.net 2005 project that is supposed to get strings from
a ressource file depending on the culture.
This is the code for the class
Imports System
Imports System.Globalization
Imports System.Threading
Imports System.Resources
Imports System.Reflection
Public Class clsRessources
Public Shared Function GetMsgString(ByVal RessourcNameString As String) As
String
Try
' Create a resource manager to retrieve resources.
Dim rm As New ResourceManager(AssemblyBaseNameForRm,
[Assembly].GetExecutingAssembly())
'''' Get the culture of the currently executing thread.
'''' The value of ci will determine the culture of
'''' the resources that the resource manager retrieves.
Dim ci As CultureInfo = Thread.CurrentThread.CurrentCulture
' Retrieve the value of the string resource named
' RessourcNameString localized for the culture specified by ci.
Return (rm.GetString("RessourcNameString", ci))
Catch ex As Exception
Return Nothing
MsgBox(ex.Message)
End Try
End Function
If have two ressource files in the project, One named strRessourcesErr.resx
and the other strRessourcesErr.fr.resx. Both files contain the correct
values for the ressource name string that the class is looking for yet the
class always returns nothing. No error messages are generated. the
AssemblyBaseNameForRm is correct, the value of
[Assembly].GetExecutingAssembly() I can't seem to be able to check in the
immediate window yet I suspect its OK.
Why does this not work, from reading all the docs its supposed to.
Any help appreciated.
Bob