Click here to Skip to main content
15,905,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello All,

I am writing on this page for the first time and I believe and enjoy discussion on this platform.
I need assistance in a situation where I want to read text file to array. I have added the file to the app via properties, debug tab and select the text file.
Now I wanted to be able to read the content of the file just like I can in this way.

Dim Elines() as String

Elines = IO.File.ReadAllLines("Jumpers.txt")

normally working with the above code its fine, I can further read each line and split by a value, but trying to do this

Elines = IO.File.ReadAllLines(My.Resources.ResourceManager.GetObject("Jumpers.txt"))

I got the error "Value cannot be Null"

Thank you all in anticipation.

1 solution

If you have added it as a resource, all you need is to say:
Dim allLines As String = My.Resources.Jumpers
And use Split to break it into lines.
Share this answer
Ibpet11 25-Aug-14 11:30am    
Thank you OriginalGriff

this is the Solution I needed.
OriginalGriff 25-Aug-14 11:49am    
You're welcome!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900