Search code examples
vb.netstreamreader

StreamReader.Peek for Multiline Textbox


I coded the StreamReader.Peek method like this

Dim sr As StreamReader = New StreamReader(Textbox1.Text)
Dim line As String = ""
Do While sr.Peek() >= 0
....

But it came up with an exception that it could not find the file "text in textbox" I realized the Peek method is only for text files, so is there any equivalent? By the way Textbox1 is a Multiline textbox


Solution

  • How about using a StringReader? The syntax is just the same otherwise.