Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Jun 29, 2011 05:11 AM by shree_ars
Participant
1395 Points
776 Posts
Jun 23, 2011 10:11 AM|LINK
Hi
i have used "ResXResourceWriter" fro adding new resource key to the .resx file.
But when i execute the code, the already available keys get deleted and the key which i have added newly , only be present.
i think the issue is due to the "ResourceWriter" which i have used.
PLz may i know any other way.
my requirement is to add the new key/value pair to the .resx file programmatically,
without deleteing existing one and without reading the full .resx file once again (i.e swapping temp variable)
All-Star
18926 Points
3662 Posts
Jun 23, 2011 10:19 AM|LINK
shree_ars But when i execute the code, the already available keys get deleted and the key which i have added newly , only be present.
can u post some code,
btw i can't control my laugh .
Jun 23, 2011 10:31 AM|LINK
ResXResourceWriter resourceWriter = new ResXResourceWriter("fileName");
resourceWriter.AddResource("key1", "from extensibility code45");
resourceWriter.Generate();
resourceWriter.Close();
Jun 23, 2011 10:45 AM|LINK
don't call Generate and test agian.
Jun 23, 2011 11:44 AM|LINK
nothing happen. same issues occured
Star
14859 Points
1525 Posts
Microsoft
Jun 28, 2011 08:06 AM|LINK
Hi shree_ars,
Thanks for your post.
Please refer the example in the following article. The code adds resources to the writer and writes the resources to the file.
http://msdn.microsoft.com/en-us/library/s0escb14.aspx
hope this helps, thanks.
Jun 29, 2011 05:11 AM|LINK
HI all,
thanks alot for all your valueble solutions.
actuallt i have done it by reading the .resx file as XML and adding the xml node to the xml document
which gets updated to the original .resx file.
thank you friends
shree_ars
Participant
1395 Points
776 Posts
Adding new resource key programmatically
Jun 23, 2011 10:11 AM|LINK
Hi
i have used "ResXResourceWriter" fro adding new resource key to the .resx file.
But when i execute the code, the already available keys get deleted and the key which i have added newly , only be present.
i think the issue is due to the "ResourceWriter" which i have used.
PLz may i know any other way.
my requirement is to add the new key/value pair to the .resx file programmatically,
without deleteing existing one and without reading the full .resx file once again (i.e swapping temp variable)
shashankgwl
All-Star
18926 Points
3662 Posts
Re: Adding new resource key programmatically
Jun 23, 2011 10:19 AM|LINK
can u post some code,
btw i can't control my laugh
.
All is well if it runs well.
blog
shree_ars
Participant
1395 Points
776 Posts
Re: Adding new resource key programmatically
Jun 23, 2011 10:31 AM|LINK
ResXResourceWriter resourceWriter = new ResXResourceWriter("fileName");
resourceWriter.AddResource("key1", "from extensibility code45");
resourceWriter.Generate();
resourceWriter.Close();
shashankgwl
All-Star
18926 Points
3662 Posts
Re: Adding new resource key programmatically
Jun 23, 2011 10:45 AM|LINK
don't call Generate and test agian.
All is well if it runs well.
blog
shree_ars
Participant
1395 Points
776 Posts
Re: Adding new resource key programmatically
Jun 23, 2011 11:44 AM|LINK
nothing happen. same issues occured
Yanping Wang...
Star
14859 Points
1525 Posts
Microsoft
Re: Adding new resource key programmatically
Jun 28, 2011 08:06 AM|LINK
Hi shree_ars,
Thanks for your post.
Please refer the example in the following article. The code adds resources to the writer and writes the resources to the file.
http://msdn.microsoft.com/en-us/library/s0escb14.aspx
hope this helps, thanks.
Feedback to us
Develop and promote your apps in Windows Store
shree_ars
Participant
1395 Points
776 Posts
Re: Adding new resource key programmatically
Jun 29, 2011 05:11 AM|LINK
HI all,
thanks alot for all your valueble solutions.
actuallt i have done it by reading the .resx file as XML and adding the xml node to the xml document
which gets updated to the original .resx file.
thank you friends