Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

VB.net Embedded resource problems...

2 views
Skip to first unread message

§tudz

unread,
Sep 3, 2003, 5:00:05 PM9/3/03
to
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,
 

--
§tudz
 
www.studzworld.com - Graphics, downloads, and alot of 3D
www.icewebdesign.biz - Cool Crisp and Hard web design

Frosty

unread,
Sep 8, 2003, 8:44:56 AM9/8/03
to

"§tudz" <Ad...@StudzWorld.com> wrote in
news:bj5koh$elf$1...@newsg1.svr.pol.co.uk:

> 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


xvxvxvxxvxvxxxxxxxxx

unread,
Jun 23, 2004, 3:51:23 AM6/23/04
to
Work here????? Im have the educational version.


0 new messages