command2_click代码修改如下,可得到正确的测试总数和测试pass数:
Private Sub Command2_Click()
Dim b() As String, i As Integer, Str As String
Call Command1_Click
For z = 0 To 24
Label9(z).Caption = ""
Label13(z).Caption = ""
Label14(z).Caption = ""
Label15(z).Caption = ""
Label11(z).Caption = ""
Label12(z).Caption = ""
Next z
Dim q As Integer
For i = 0 To File1.ListCount - 1
Text2.Text = ""
Label2.Top = Label2.Top + Label2.Height
If Label2.Top > Frame4.Height Then Label2.Top = 0
Label1.Caption = ""
Label1.ForeColor = QBColor(12)
Label1.Caption = "正在读取"
Text1.Text = File1.List(i)
'------------------------------------------------------------------------------------------------------------
'片号:(十进制)
If Right(Dir1.Path, 1) = "\" Then
Open (Dir1.Path & "\" & File1.List(i)) For Input As #1
Else
Open (Dir1.Path & "\" & File1.List(i)) For Input As #1
End If
Do Until EOF(1)
Line Input #1, Str
'读出一整行
If Left(Str, 9) = "Wafer ID:" Then Label9(i).Caption = Right(Str, 2)
'片号
If Left(Str, 8) = "Project:" Then Label11(i).Caption = Right(Str, Len(Str) - 8)
'程序名
If Left(Str, 7) = "Lot ID:" Then Label12(i).Caption = Right(Str, Len(Str) - 7)
'批号
If Left(Str, 8) = "Comment:" Then Label13(i).Caption = Right(Str, Len(Str) - 8)
'注释
If Left(Str, 7) = "<Total>" Then
b = Split(Str, "---")
b(3) = Trim(b(3))
b = Split(b(3), Chr(9))
Label14(i) = Trim(b(1))
'获取总数
Label15(i) = Trim(b(2))
'测试Pass数
End If
Loop
Close #1
Text2.Text = ""
Next i
'------------------------------------------------------------------------------------------------------------
Text1.Text = ""
Label1.Caption = ""
Label1.ForeColor = QBColor(10)
Label1.Caption = "读取完毕"
Label2.Top = 0
Label2.Left = 0
Label17.Caption = File1.ListCount
'------------------------------------------------------------------------------------------------------------
'If
'Label19.Caption = ""
求助:如果label11数组.Caption完全一致的话,则Label19则显示绿色“一致”,反之显示红色“有异”
'Label19.ForeColor = QBColor(10)
并且label11数组.Caption中所有与label(0).Caption不同的显示成红色
'Label19.Caption = "一致"
'Else
'Label19.ForeColor = QBColor(12)
'Label19.Caption = "有异"
'End If
'------------------------------------------------------------------------------------------------------------
End Sub