0

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

Phexion
  • 59
  • 1
  • 2
  • 8
  • It's not clear what you are asking. The constructor for StreamReader that takes a string is to specify a filename to open and read. Does Textbox1.Text contain a filename? Or do you need to read through the data in the textbox, in which case the StringReader would be appropriate as yu_ominae stated below. What exception do you get? – Chris Dunaway Jul 16 '14 at 13:58

1 Answers1

2

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

yu_ominae
  • 2,975
  • 6
  • 39
  • 76