-2

I have a text file in this format:

Number: xxxxx
Name: xxxxx
Last Name: xxxxxx

How can I get each line into a String array or Arraylist?

I found something similar here but it's not clear to me.

Why is not duplicate: If you don't know the function or method, you will never find the "possible duplicated". If you type my common question in Google or Stack search, you will be able to find it. I think here, some people is too paranoid with duplicates.

Community
  • 1
  • 1
Mrquestion
  • 771
  • 1
  • 6
  • 16
  • Use [*`File.ReadAllLines`*](https://msdn.microsoft.com/en-us/library/s2tte0y1(v=vs.110).aspx?cs-save-lang=1&cs-lang=vb#code-snippet-2) – Wiktor Stribiżew Oct 19 '16 at 08:00
  • 2
    Possible duplicate of [What is the difference between File.ReadAllLines() and File.ReadAllText()?](http://stackoverflow.com/questions/2965497/what-is-the-difference-between-file-readalllines-and-file-readalltext) – Wiktor Stribiżew Oct 19 '16 at 08:09
  • Thank you so much!!! I did it with that, I can't give you any point in comments but you deserve it. Edit: answering to you possible duplicate... I think I'm not asking the same thing although the answer could be equal... My question is much more common to find what you are looking for in Stack Search – Mrquestion Oct 19 '16 at 08:11
  • No need to, I prefer not to answer evident duplicate questions. There is an answer below to accept. – Wiktor Stribiżew Oct 19 '16 at 08:13

1 Answers1

1

To read all lines into a string array use this:

Dim lines() As String = File.ReadAllLines(filename) 
Bugs
  • 4,491
  • 9
  • 32
  • 41