Wednesday, November 3, 2010

Use the Peek method of the StreamReader

HOW TO: Use the Peek method
Syntax
streamReaderVariableName.Peek

Example
Dim lineOfText As String
   Do Until inFile.Peek = -1
   lineOfText = inFile.ReadLine
   MessageBox.Show(lineOfText)
Loop
reads each line of the file associated with the inFile variable, line by line. Each line (excluding the newline character) is assigned to the lineOfText variable and is then displayed in a messagebox.

No comments:

Post a Comment