So in my VBE2010 project I have an XML file containing some values I need ("UnitVals.xml"). When I accessed this before, I was simply placing it in the project folder, finding the local path from System, and reading the file into an XMLDocument object.
I didn't really like having to concern myself with the location of the file, however, so I set its "Build Action" property to "Embedded Resource." There are numerous examples of code on the net as to how to use this, which I have written into my code as follows-
Unfortunately, my Stream keeps returning as Nothing. Does anyone know why this might be?
I didn't really like having to concern myself with the location of the file, however, so I set its "Build Action" property to "Embedded Resource." There are numerous examples of code on the net as to how to use this, which I have written into my code as follows-
VB.NET:
Dim xmlDoc As New Xml.XmlDocument
Dim s As System.IO.Stream = System.Reflection.Assembly.GetExecutingAssembly.GetManifestResourceStream("UnitVals.xml")
Dim reader As New System.IO.StreamReader(s)
xmlDoc.LoadXml(reader.ReadToEnd)
Unfortunately, my Stream keeps returning as Nothing. Does anyone know why this might be?
Last edited: