C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Interview   Jobs   Projects   Offshore Development    
Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing | Talk to Us |



My Profile

Gifts

Active Members
TodayLast 7 Days more...







MissingManifestException


Posted Date: 24 Mar 2008      Total Responses: 9

Posted By: Ramya       Member Level: Silver     Points: 2


I have a resource file in my bin directory. For language settings, my program reads the string from the resource file using

resourceManager rm.GetString(string);

This works fine as long as a string is present in the resource file.

Can anyone suggest me how to check if the specified string is present in the resource file. Otherwise i get missing manifest exception as the string is not present in resource file.





Responses

Author: DurgaprasadCh    24 Mar 2008Member Level: SilverRating:     Points: 2
Ramya,

I hope, validating for null value should work out.

if (resource.GetString("mystring") != null)
{...}
else
{...}

Please revert back if this is not what you are looking for or if you find correct answer.

-Durga


Author: Ramya    25 Mar 2008Member Level: SilverRating:     Points: 2
Hi Durgaprasad,

Thanks for your reply.

I tried it equating to null as the same as specified above. But it is giving me error once it comes to the line resource.GetString() not even checking for null.




Author: DurgaprasadCh    25 Mar 2008Member Level: SilverRating:     Points: 2
hmmm...I believe "resource" would be declared and defined as ResourceManager right?


Author: Ramya    25 Mar 2008Member Level: SilverRating:     Points: 2
yes, it is.

ResourceManager rm = ResourceManager.CreateFileBasedResourceManager("resource", strResourcesPath, null);

and then rm.GetString("---");

I appreciate your continued help.




Author: Ramya    25 Mar 2008Member Level: SilverRating:     Points: 2
Also, is there a way to find whether a string exists in resource file



Author: Ramya    25 Mar 2008Member Level: SilverRating:     Points: 2
yes, it is.

ResourceManager rm = ResourceManager.CreateFileBasedResourceManager("resource", strResourcesPath, null);

and then rm.GetString("---");

I appreciate your continued help.




Author: DurgaprasadCh    26 Mar 2008Member Level: SilverRating:     Points: 2
hmmm..I don't think we have any other specific method to verify whether string exists or not apart from using GetString.

Also, just a note, if the runtime fails to load or locate this culture specific resource, it will read the intended resource text from the default resource. So one work around is provide default strings in default .resources file to avoid runtime errors.



Author: Ramya    27 Mar 2008Member Level: SilverRating:     Points: 2
Durgaprasad,
Thanks for the info. It is interesting. Can u pls. give me a code sample for using default resource file.


Author: DurgaprasadCh    31 Mar 2008Member Level: SilverRating:     Points: 2
hey Ramya, Sorry!! I was out last week and just back in city today.

There is nothing much to do to create a default resource file, normally when you create culture specific resource file, you give name as resourcefile.es-ES.resources (for spanish) but create another file like resourcefile.resx this will act as default resource file for your application.

Lemme know if your problem got solved else we can look at alternatives.

-Durga.


Post Reply
You must Sign In to post a response.
Next : populating datagridview from xml file
Previous : plz solve this error
Return to Discussion Forum
Post New Message
Category: .NET

Related Messages



dotNet Slackers   BizTalk Adaptors    Web Design

silicone halloween masks

Contact Us    Privacy Policy    Terms Of Use