I'm thinking that the problem is not necessarily in the ResultsBox script, but rather the Execute button script that sends the state. If I could send the state via script rather than the properties dialog box, then I could sleep for a period of time before I send it. Otherwise, as soon as the script finishes the state is sent. I don't have an opportunity to actually wait for the file to get written to if necessary when I do it via the properties box.
Also, in the script above...
if the results.txt file is completely empty, the script throws an error. If I open the results.txt and put even a single space in it and save it, then the script does NOT throw an error.
I tried putting in
If Control.Text = "" Then
MsgBox "The results file is empty"
exit sub
End If
The problem here is that if I put this BEFORE Control.Text = Results.Text.ReadAll then you will get that popup message everysingle time. Since it has not yet read in the file, it is always = "" at this stage.
If I place it AFTER that line, well it's too late, and the code is basically useless, because if the file is 0 bits then the Control.Text = Results.Text.ReadAll line is the one that throws the error.
Is there anyway around this other than making sure that I actually create a results.txt file and put a single character or space in it whenever I amy package this app up and put it on another machine?
Thanks again,
Brain21