Avatar of Brian
Brian
Flag for United States of America asked on

Loop while string is not empty or null

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

Visual Basic.NET

Avatar of undefined
Last Comment
Brian

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Darrell Porter

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Brian

ASKER
Perfect... thanks!
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck