Dim path As String = Application.ProductName & " test.txt" '/// must be the exact path of the embedded exe.
Dim sReader As New IO.StreamReader(MyBase.GetType.Assembly.GetManifestResourceStream(path))
Dim sWriter As New IO.StreamWriter(New IO.FileStream("C:\test.txt", IO.FileMode.OpenOrCreate))
While Not sReader.Peek
sWriter.WriteLine(sReader.ReadLine)
End While
sWriter.Close()
sReader.Close()
End Sub
> hi,
>
> I've got a problem with embedded resources, I'm using this code:
>
>
> ----------------------------------------------------------------------
-
> ---------
>
> Dim path As String = Application.ProductName & " test.txt" '/// must
> be the exact path of the embedded exe.
>
> Dim sReader As New
> IO.StreamReader(MyBase.GetType.Assembly.GetManifestResourceStream
(path)
> )
>
> Dim sWriter As New IO.StreamWriter(New IO.FileStream("C:\test.txt",
> IO.FileMode.OpenOrCreate))
>
> While Not sReader.Peek
>
> sWriter.WriteLine(sReader.ReadLine)
>
> End While
>
> sWriter.Close()
>
> sReader.Close()
>
> End Sub
>
>
> ----------------------------------------------------------------------
-
> ---------
>
>
>
> I am trying to get the test.txt file copied from the program's exe to
> the C:\
>
> but on this line:
>
> ----------------------------------------------------------------------
-
> ---------
>
> Dim sReader As New
> IO.StreamReader(MyBase.GetType.Assembly.GetManifestResourceStream
(path)
> )
>
> ----------------------------------------------------------------------
-
> ---------
>
>
> I get told that it can't be NULL, yet the variable 'path' is not
> empty?
>
> any help will be greatful,
>
>
Hi, I don't know if you already found the problem but you can try this:
Just replace your variable path by : Application.ExecutablePath
I don't know if it will help.
Patrick