How to read a Resourced file?
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: How to read a Resourced file?

  1. #1
    Join Date
    Mar 2010
    Posts
    10

    How to read a Resourced file?

    Hi,

    my previous question about reading Resource Assembly info was greatly honoured and solved.

    but I'v encountered another issue.

    I simply access an .xml file from my application.
    But after publishing and installing my application it misses my xml file....
    So thinking being smart (;-)) I added this .xml file as a resource to my solution.

    But now I wonder how I programatically should access this xml file from the resource.

    Thanks

    Henk

  2. #2
    Join Date
    Mar 2010
    Posts
    10

    Re: How to read a Resourced file?

    Hi Henk,

    Just let me answer myself... ;-)

    When accessing a resource which is an xml file then it will return a STRING to the CONTENTS of the resourced xml file.

    So to get the xml contents we need:

    string s = MyNameSpace.Properties.Resources.MyXmlFileName;

    To convert the data to an internal computer memory XML document we do:

    XmlDocument.InnerXml = s;

    thats all,

    thanks for listening anyway.

    Henk

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center