Hi everyone, I'm new to the forums, and VB explorer didn't answer the question I have so now I'm here :-P
I have 3 arrays that are declared as such:
Then on Form Load it has this:Code:Dim marray() As Variant
Dim resArray() As String
Dim errText() As String
marray works fine, all the for loops I have through the program it saves the data just fine. But the other two I'm having massive problems. They don't seem to save any data.Code:ReDim marray(1 To mcnt) As Variant
ReDim resArray(1 To mcnt) As String
ReDim errText(1 To mcnt) As String
Then I have MsgBoxes in the Finish function like thisCode:Private Sub RunTest_Click()
'Test all the machines on the network and tabulate results'
For i = 1 To mcnt
rMachine = marray(i)
rescnt = i
errtxtcnt = i
Call StartTest(rescnt, errtxtcnt, rMachine, lUsername, i)
Next
'Analyze all the data next.'
Call Finish
End Sub
Private Sub StartTest(ByRef rescnt As Integer, ByRef errtxtcnt As Integer, ByRef rMachine As String, ByRef lUsername As String, ByRef i As Integer)
....
If ErrorStatus = 1 Then
Call NetErrorHandling(rescnt, errtxtcnt, rMachine, lUsername, i, ErrorCode)
End If
testFile = FreeFile
Open "C:\SystemReq\testfile.txt" For Output As #testFile
Print #testFile, "Test Stuff"
Close #testFile
iFile4 = FreeFile
Open "C:\SystemReq\copyfile.bat" For Output As #iFile4
Print #iFile4, "cd\systemreq"
Print #iFile4, "copy testfile.txt \\" & rMachine & "\C$ /Y > copyfileresult1.txt"
Print #iFile4, "copy testfile.txt \\" & rMachine & "\C$ /Y 2> copyfileresult2.txt"
Close #iFile4
ret2 = ShellAndWait("C:\systemreq\copyfile.bat", vbHide)
iFile5 = FreeFile
Open "C:\SystemReq\copyfileresult1.txt" For Input As #iFile5
Do While Not EOF(iFile5)
Line Input #iFile5, temp3Text
TextData = temp3Text
If (InStr(1, TextData, "0 File", 1) = 8) Then
resArray(rescnt) = "F"
errText(errtxtcnt) = "Copy Failed"
Exit Do
End If
If (InStr(1, TextData, "1 File", 1) = 8) Then
resArray(errtxtcnt) = "P"
errText(rescnt) = "No error!"
Exit Do
End If
Loop
Close #iFile5
Marray(x) shows up fine for each value of x but resArray and errText are blank. I can't figure it out, I'd be much obliged for any help...Code:For x=1 to mcnt
MsgBox (marray(x))
MsgBox (resArray(x))
MsgBox (errText(x))
Next
Or check out my full project at:
http://www.tammuz.us/vb/SystemReq.zip
