Hello,
I want to use resource files in my reports. I found the way that has to be done w.r.t. the culture-identification, and that is quite simple.
My problem however is that I don't know where to put the files. I found some C# code that will allow me to access a resource file but that does not work as I don't know where I have to tell it where the resourcefiles are. That code is:
public static string ReadResourceValue(string file, string key)
{
//value for our return value
string resourceValue = string.Empty;
try
{
// specify your resource file name
string resourceFile = file;
// get the path of your file
// string filePath = System.AppDomain.CurrentDomain.BaseDirectory.ToString();
string filePath = "";
// create a resource manager for reading from
//the resx file
ResourceManager resourceManager = ResourceManager.CreateFileBasedResourceManager(resourceFile, filePath, null);
// retrieve the value of the specified key
resourceValue = resourceManager.GetString(key);
}
catch (Exception ex)
{
resourceValue = string.Empty;
}
return resourceValue;
}
Is there a simple (simpler) way to do this?
Thank you
I want to use resource files in my reports. I found the way that has to be done w.r.t. the culture-identification, and that is quite simple.
My problem however is that I don't know where to put the files. I found some C# code that will allow me to access a resource file but that does not work as I don't know where I have to tell it where the resourcefiles are. That code is:
public static string ReadResourceValue(string file, string key)
{
//value for our return value
string resourceValue = string.Empty;
try
{
// specify your resource file name
string resourceFile = file;
// get the path of your file
// string filePath = System.AppDomain.CurrentDomain.BaseDirectory.ToString();
string filePath = "";
// create a resource manager for reading from
//the resx file
ResourceManager resourceManager = ResourceManager.CreateFileBasedResourceManager(resourceFile, filePath, null);
// retrieve the value of the specified key
resourceValue = resourceManager.GetString(key);
}
catch (Exception ex)
{
resourceValue = string.Empty;
}
return resourceValue;
}
Is there a simple (simpler) way to do this?
Thank you