embedded text file

  • Thread starter Peter van der veen
  • Start date
P

Peter van der veen

Hi

I have a VB project and added a text file to it as an embedded
resource.

But i can'f find a way now how to read this file just as a normal text
file with the streamreader command.

Anyone can give me a hint?

Peter
 
T

Truong Hong Thi

Stream resStream =
Assembly.GetExecutingAssembly().GetManifestResourceStream(this.GetType(),
fileName)

Remember to close the stream.
 
H

Herfried K. Wagner [MVP]

I have a VB project and added a text file to it as an embedded
resource.

But i can'f find a way now how to read this file just as a normal text
file with the streamreader command.

\\\
Imports System.IO
..
..
..
Dim f As Stream =
System.Reflection.Assembly.GetEntryAssembly().GetManifestResourceStream( _
"<Name of the root namespace>.test.txt" _
)
Dim st As New StreamReader(f)
MsgBox(st.ReadToEnd())
st.Close()
///
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top