Here is a bit of code I am using now, just wondering if there is any potential problems with the way this is coded that may jump out and bite me later.
Sub SendNextLine()
Log("Send Next Line")
Dim dRecord As String
If DataReader.Ready Then
dRecord=DataReader.ReadLine
If dRecord.Length>0 Then
fProcessed=fProcessed+dRecord.Length
ProgressBar1.Progress=Round(fProcessed/fTotal*100)
ast.Write("R1," & dRecord & Chr(10))
Else
SendNextLine
End If
Else
lblStatus.text="Upload Complete"
lblresult.Text=(IntGood) & " good Records" & Chr(10) & (intBad) & " Bad Records"
btnOK.Visible=True
Log("no more data to send?")
DataReader.close
End If
End Sub
When an upload is called for another routine initializes the TextReader which will be reading from a local data file, sets a few vars then calls this routine.
When new text comes in from the server the routine above is called again.
The main thing I am wondering about is would there be any issue with that one line in the else condition which calls this routine again. Normally there are no blank lines in the data so it will likely never execute but I like to make sure that case in handled just in case an extra line feed finds its way into the file.