We help IT Professionals succeed at work.

Loop while string is not empty or null

Brian
Brian asked
on
I have the following loop that I want to continue until every line in SR (StreamReader) has been read and outputted. What condition should I add to the Do While Loop to have it read all the lines?

        Do While (strLine ???)            
            strLine = SR.ReadLine                               '// Read in line
            If strLine Is Nothing Then
                MessageBox.Show("Unable to extra data, please try again. If it continues to fail, please contact Brian L.")
                Exit Sub
            End If
            '// Output line when it contains useful info
            If strLine.Contains("Gi") Then
                OutputTextBox.AppendText(strLine)
                OutputTextBox.AppendText(vbCrLf)
            End If
        Loop

Open in new window

Comment
Watch Question

Enterprise Business Process Architect
Commented:
Do Until strLine.EndOfStream

Open in new window

BrianSystems Administrator

Author

Commented:
Perfect... thanks!