Hi guys!
I'm new to VB .Net (I can do the basic things like writing up functions, and simple events) and I decided to add a function to a piece of already-written code.
I have a text file in the root of the project which I have set as "embedded resource", which I believe is a step in the right direction
.
I'd like to input the whole text file's contents into a string.
My code is as follows:
My problem is with line 4 of the above code when it says that StreamReader is trying to read a null value. Now, I'm guessing that it's hit a problem with trying to use the resource, so I'm guessing I haven't done something right with respect to finding the namespace. However, I'm not sure.
Also, say I put this startofhtml.txy in folder 2, which is located in folder 1 which is located in the root. Do I define the startfilename as follows?:
Thanks again
I'm new to VB .Net (I can do the basic things like writing up functions, and simple events) and I decided to add a function to a piece of already-written code.
I have a text file in the root of the project which I have set as "embedded resource", which I believe is a step in the right direction
I'd like to input the whole text file's contents into a string.
My code is as follows:
Dim startfileName As String = "Startofhtml.txt" Dim Asm As System.Reflection.[Assembly] = System.Reflection.[Assembly].GetExecutingAssembly() Dim strm As Stream = Asm.GetManifestResourceStream(Asm.GetName().Name.ToString() + "." + startfileName) Dim reader As StreamReader = New StreamReader(strm) Dim preview As String = reader.ReadToEnd()
My problem is with line 4 of the above code when it says that StreamReader is trying to read a null value. Now, I'm guessing that it's hit a problem with trying to use the resource, so I'm guessing I haven't done something right with respect to finding the namespace. However, I'm not sure.
Also, say I put this startofhtml.txy in folder 2, which is located in folder 1 which is located in the root. Do I define the startfilename as follows?:
Dim startfileName As String = "folder 1.folder 2.Startofhtml.txt"
Thanks again

Help
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.




Back to top









