skipping a line

rangerbud249

Active member
Joined
Aug 18, 2004
Messages
27
Programming Experience
Beginner
Hello,

I am getting an error when reading mySTR if the line that I read is empty. Does anyone know how to skip a line and continue to the next line in my Do Until, Loop statement.

here is my code.

Do Until r.Peek = -1

Dim mySTR As String
mySTR = r.ReadLine

Loop

Thanks
Jose


 
This is what I have done in the past:
VB.NET:
     [size=2][color=#0000ff]Dim objStreamReader As StreamReader
        Dim strLine As String
    
        objStreamReader = New StreamReader(filename.ToString)
        strLine = objStreamReader.ReadLine
    
        Do While Not strLine Is Nothing
     If strLine = "" Then
 	  ' Read Next Line
 	  strLine = objStreamReader.ReadLine
  	Else
 	  ' Process it as needed
 	End If
   Loop
    [/color][/size][size=2][color=#0000ff][size=2]

I am assuming that your r variable is a StreamReader or something similar....
[/size][/color][/size]
 
Last edited:
Back
Top