Reading embedded Resource textfile

  • Thread starter Thread starter Georg Hickel
  • Start date Start date
G

Georg Hickel

Hi,
in my app i need a script to setup a database. The script file is now read
by the app with a streamreader.

Now i want to read the script from an resource file which is embedded in my
app. I created a resource "installscript.resx" and added the file
"script.sql". Now i dont know a way the read the content of the file in the
resource.

i would like to read from the resource like i did from the original file,
but i cant find a stream method which reads from a resource.

is there a way to do this or is my idea totally wrong and i need another
approach?
I just want that the installation script no longer a file the user can edit
or read or i have to look for in a strange location.

any help is welcome

thanks
Georg

(e-mail address removed)
 
I think you want to use
Reflection.Assembly.GetExecutingAssembly.GetManifestResourceStream(s)
where s is the name of the resource. For an icon named abc, s is like
Application.ProductName & ".abc.ico"
I guess that the format for your embedded resource file will be similar.
 
Back
Top