Thanks Onur.
Your example helped me a lot.
Thanks again.
Dan
Hi VB Gurus,
I know how to read/write file from a path.
But I have a text file witnin my project, and don't know how to read it.
The
file is embedded within a project.
I'll appreciate any help/suggestion/advice I get.
Thanks, Dan
Hi,
First let's assume you have a text file named "TextFile1.txt" in your
project and let your project's name and root namespace name be
"WindowsApplication1".
Set TextFile1.txt's "build action" property to "Embedded Resource" as
it should be.
Then you can get the text of embedded text file using
GetManifestResourceStream as follows:
'---------------------------------------------------------
Dim mystream As System.IO.Stream = _
System.Reflection.Assembly. _
GetExecutingAssembly.GetManifestResourceStream _
("WindowsApplication1.TextFile1.txt")
Using reader As New IO.StreamReader(mystream)
' Read the contents in MsgBox for example
MsgBox(reader.ReadToEnd)
End Using
'---------------------------------------------------------
Hope it helps,
Onur Güzel
End Using