how can i read a specific text from a text file back to a textbox?

so here are the text

heburn@YAHOO.COM, TAGUIG, 9460593, ASRock, 2.4 GHz, Dual, Core, HDD, 160 GB,5, 200, 2 GB, 2,512 MB, YES

and i just want get the text

You can read the entire file into a string array by

Dim text() As String = System.IO.File.ReadAllLines(filename)

If the file contains many lines and you only want one (assuming you can uniquely identify a line by, for example, the email address) you can do

Dim email As String = "heburn@YAHOO.COM"
Dim text() As String = Filter(System.IO.File.ReadAllLines(filename,email))

Assuming a match was found, your line would be text(0). You can split it by

Dim fields() As String = text(0).Split(",")

Then the fields you want would be


it tried the code but after i change the filename the email string gets invalid

it says whenever i point the cursor on the email string "Value of type 'String' cannot be converted to 'System.Text.Encoding'" what can i do to convert that string?

Edited 3 Years Ago by aarviii

Sorry. My mistake. The line should have been

Dim text() As String = Filter(System.IO.File.ReadAllLines(filename),email)

Edited 3 Years Ago by Reverend Jim

This article has been dead for over six months. Start a new discussion instead.