[RESOLVED] [2005] Using VS2005 To read text files and separate lines.
Hi there,
I have found out how to read the contents of a file in one go.
Now i need to separate the whole string into line by line, how do i do that?
I understand i can use string.split command, but what is the character entry for the line break?
Cheers!
VB Code:
If IO.File.Exists(Me.txtFilePath.Text) = True Then
Dim fileText As String = My.Computer.FileSystem.ReadAllText(Me.txtFilePath.Text)
Me.rtbContents.Text = fileText
End If
Re: [2005] Using VS2005 To read text files and separate lines.
Use ReadAllLines straight to an array
VB Code:
Dim fileText() As String = IO.File.ReadAllLines(Me.txtFilePath.Text)
'or arraylist
Dim fileText As New ArrayList(IO.File.ReadAllLines(Me.txtFilePath.Text))
Re: [2005] Using VS2005 To read text files and separate lines.
VB Code:
Dim fileText() As String = IO.File.ReadAllLines(Me.txtFilePath.Text)
Dim str() As String = filetext(n).split(",")