Well, I fixed the problem by moving the check for success into the IF statement. Now it only prints one instance of each error.
I still don't know why this caused the error.
Do While sr.EndOfStream = False
'Read in a line from file
linecheck = sr.ReadLine
'Check that line read isn't empty string and that it contains 2 parts, otherwise discard
If ((linecheck = "") Or (linecheck.Contains(",") = False)) Then
Else
'If ok, split read line and put in entry
entry = linecheck.Split(",")
Dim Ping As Ping = New Ping
Dim PingReply As PingReply
success = 0
For t As Integer = 0 To 3
If entry(0) = "y" Then
PingReply = Ping.Send(entry(1), 2000)
'Set current activity on toolstrip and cause repaint
tssActivity.Text = "Current Task: Pinging " & entry(2) & ": " & entry(1)
tssActivity.Invalidate()
'Set result parts 1 & 2 to current ping entry
line(0) = entry(2) & ": "
line(1) = entry(1)
'Set result part 3 (line(2)) to ping if success, error message if failed
If PingReply.Status = IPStatus.Success Then
line(2) = PingReply.RoundtripTime.ToString
success += 1
Else
line(2) = PingReply.Status.ToString
errtemp = line(0) & Chr(13) & Chr(10) & line(1) & Chr(9) & Chr(9) & "Ping: " & line(2) & Chr(13) & Chr(10)
End If
End If
Ping.Dispose()
Next
If success = 0 Then
errstring += errtemp
End If
End If
'Set result string (line(3))
line(3) = line(0) & Chr(13) & Chr(10) & line(1) & Chr(9) & Chr(9) & "Ping: " & line(2) & Chr(13) & Chr(10)
rtbResult.Text += line(3)
'kill ping after used
rtbResult.Invalidate()
Me.Refresh()
Loop