Click here to Skip to main content
15,890,282 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,

i have XML file i used to open it like,

C#
XmlDocument doc = new XmlDocument();
doc.Load(Application.GetResourceStream(new Uri("pack://application:,,,/Ribbon.xml")).Stream);

but this stream is read only, i can't write on it,

the real problem is how to write on a file that i haven't his full path i just have his Uri, and i google for it and don't found any solution please help
Posted
Updated 25-Jan-12 13:46pm
v2

It's not a separate file, it's a resource embedded into your executable.
doc.Load(Application.GetResourceStream(new Uri("pack://application:,,,/Ribbon.xml")).Stream);


Best regards
Espen Harlinn
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 25-Jan-12 16:43pm    
Yes, that would retrieve the content from the resource, my 5.
--SA
Espen Harlinn 25-Jan-12 16:44pm    
Thank you, Sergey :)
thatraja 26-Jan-12 3:23am    
5!
Espen Harlinn 26-Jan-12 6:29am    
Thank you thatraja!
Mohamed Ahmed Abdullah 26-Jan-12 22:42pm    
yes it's embedded resource but still how can i write on it??
first you have to to make the Build Action for the file Content then use the
Environment.CurrentDirectory

to get the project path. then you can use the file easily (Read, Write,...)

Thanks All.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900