-
Oct 5th, 2006, 01:25 PM
#1
Thread Starter
Frenzied Member
[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
If you find my thread helpful, please remember to rate me
-
Oct 5th, 2006, 01:46 PM
#2
Hyperactive Member
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))
Last edited by thingimijig; Oct 5th, 2006 at 01:51 PM.
-
Oct 5th, 2006, 04:26 PM
#3
Thread Starter
Frenzied Member
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(",")
If you find my thread helpful, please remember to rate me
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|