将Resources文本文件读取到数组 [英] Read Resources text file to array
问题描述
Hello All,
我第一次在这个页面上写作,我相信并喜欢在这个平台上讨论。
在我想要将文本文件读取到数组的情况下,我需要帮助。我已经通过属性,调试选项卡将文件添加到应用程序并选择文本文件。
现在我希望能够以这种方式读取文件的内容。 />
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.
推荐答案
如果您已将其添加为资源,您只需要说:
If you have added it as a resource, all you need is to say:
Dim allLines As String = My.Resources.Jumpers
并使用Split to bre把它分成几行。
And use Split to break it into lines.
这篇关于将Resources文本文件读取到数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!