Dim X As Long, mCount As Long Dim TempCount(1 To 4) As Long If Combo1.List(Combo1.ListIndex) = "奇" Then TempCount(1) = 1 Else TempCount(1) = 0 End If If Combo2.List(Combo1.ListIndex) = "奇" Then TempCount(2) = 1 Else TempCount(2) = 0 End If If Combo3.List(Combo1.ListIndex) = "奇" Then TempCount(3) = 1 Else TempCount(3) = 0 End If If Combo4.List(Combo1.ListIndex) = "奇" Then TempCount(4) = 1 Else TempCount(4) = 0 End If For X = 1 To ListView1.ListItems.Count If (Int(ListView1.ListItems.Item(X).SubItems(1)) + Int(ListView1.ListItems.Item(X).SubItems(2))) Mod 2 = TempCount(1) Then ElseIf (Int(ListView1.ListItems.Item(X).SubItems(2)) + Int(ListView1.ListItems.Item(X).SubItems(3))) Mod 2 = TempCount(2) Then ElseIf (Int(ListView1.ListItems.Item(X).SubItems(3)) + Int(ListView1.ListItems.Item(X).SubItems(4))) Mod 2 = TempCount(3) Then ElseIf (Int(ListView1.ListItems.Item(X).SubItems(4)) + Int(ListView1.ListItems.Item(X).SubItems(5))) Mod 2 = TempCount(4) Then Else ListView1.ListItems.Remove X End If Next X
错了,上面的代码有点问题 Dim X As Long, mCount As Long Dim TempCount(1 To 4) As Long If Combo1.List(Combo1.ListIndex) = "奇" Then TempCount(1) = 1 Else TempCount(1) = 0 End If If Combo2.List(Combo2.ListIndex) = "奇" Then TempCount(2) = 1 Else TempCount(2) = 0 End If If Combo3.List(Combo3.ListIndex) = "奇" Then TempCount(3) = 1 Else TempCount(3) = 0 End If If Combo4.List(Combo4.ListIndex) = "奇" Then TempCount(4) = 1 Else TempCount(4) = 0 End If For X = 1 To ListView1.ListItems.Count If (Int(ListView1.ListItems.Item(X).SubItems(1)) + Int(ListView1.ListItems.Item(X).SubItems(2))) Mod 2 = TempCount(1) Then ElseIf (Int(ListView1.ListItems.Item(X).SubItems(2)) + Int(ListView1.ListItems.Item(X).SubItems(3))) Mod 2 = TempCount(2) Then ElseIf (Int(ListView1.ListItems.Item(X).SubItems(3)) + Int(ListView1.ListItems.Item(X).SubItems(4))) Mod 2 = TempCount(3) Then ElseIf (Int(ListView1.ListItems.Item(X).SubItems(4)) + Int(ListView1.ListItems.Item(X).SubItems(5))) Mod 2 = TempCount(4) Then Else ListView1.ListItems.Remove X End If Next X
Dim X As Long, Y As Long, mCount As Long Dim TempCount(1 To 4) As Long For X = 1 To 4 If Combo1.List(X - 1) = "奇" Then TempCount(X) = 1 Else TempCount(X) = 0 End If Next X For X = 1 To ListView1.ListItems.Count mCount = 0 For Y = 1 To 4 If (Int(ListView1.ListItems.Item(X).SubItems(Y)) + Int(ListView1.ListItems.Item(X).SubItems(Y + 1))) Mod 2 <> TempCount(Y) Then mCount = 1 Exit For End If Next Y If mCount = 1 Then ListView1.ListItems.Remove X Next X
Dim X As Long, Y As Long, mCount As Long Dim TempCount(1 To 4) As Long For X = 1 To 4 If Combo1(X - 1).List(Combo1(X - 1).ListIndex) = "奇" Then TempCount(X) = 1 Else TempCount(X) = 0 End If Next X For X = 1 To ListView1.ListItems.Count mCount = 0 For Y = 1 To 4 If (Int(ListView1.ListItems.Item(X).SubItems(Y)) + Int(ListView1.ListItems.Item(X).SubItems(Y + 1))) Mod 2 <> TempCount(Y) Then mCount = 1 Exit For End If Next Y If mCount = 1 Then ListView1.ListItems.Remove X Next X
Dim X As Long, Y As Long, mCount As Long, myInfo() As String Dim TempCount(1 To 4) As Long For X = 1 To 4 If Combo1(X - 1).List(Combo1(X - 1).ListIndex) = "奇" Then TempCount(X) = 1 Else TempCount(X) = 0 End If Next X For X = 1 To ListView1.ListItems.Count mCount = 0 For Y = 1 To 4 myInfo = Split(ListView1.ListItems.Item(X).Text, ",") If (Int(myInfo(Y - 1)) + Int(myInfo(Y))) Mod 2 <> TempCount(Y) Then mCount = 1 Exit For End If Next Y If mCount = 1 Then ListView1.ListItems.Remove X Next X
Dim X As Long, Y As Long, mCount As Long, myInfo() As String Dim TempCount(1 To 4) As Long For X = 1 To 4 If Combo1(X - 1).List(Combo1(X - 1).ListIndex) = "奇" Then TempCount(X) = 1 Else TempCount(X) = 0 End If Next X For X = 1 To ListView1.ListItems.Count mCount = 0 For Y = 1 To 4 If ListView1.ListItems.Item(X) Is Nothing = True Then Exit For Else myInfo = Split(ListView1.ListItems.Item(X).Text, ",") If (Int(myInfo(Y - 1)) + Int(myInfo(Y))) Mod 2 <> TempCount(Y) Then mCount = 1 Exit For End If End If Next Y If mCount = 1 Then ListView1.ListItems.Remove X: X = X - 1 Next X
Dim X As Long, Y As Long, mCount As Long, myInfo() As String Dim TempCount(1 To 4) As Long, NowObj As ListItem For X = 1 To 4 If Combo20(X - 1).List(Combo20(X - 1).ListIndex) = "奇数" Then TempCount(X) = 1 Else TempCount(X) = 0 End If Next X For X = 1 To ListView1.ListItems.Count mCount = 0 On Error Resume Next Set NowObj = ListView1.ListItems.Item(X) If Err.Number <> 0 Then Set NowObj = Nothing Err.Clear Exit For End If If NowObj Is Nothing <> True Then For Y = 1 To 4 myInfo = Split(NowObj.Text, ",") If (Int(myInfo(Y - 1)) + Int(myInfo(Y))) Mod 2 <> TempCount(Y) Then mCount = 1 Exit For End If Next Y If mCount = 1 Then ListView1.ListItems.Remove X: X = X - 1 End If Next X
Dim X As Long, mCount As Long
Dim TempCount(1 To 4) As Long
If Combo1.List(Combo1.ListIndex) = "奇" Then
TempCount(1) = 1
Else
TempCount(1) = 0
End If
If Combo2.List(Combo1.ListIndex) = "奇" Then
TempCount(2) = 1
Else
TempCount(2) = 0
End If
If Combo3.List(Combo1.ListIndex) = "奇" Then
TempCount(3) = 1
Else
TempCount(3) = 0
End If
If Combo4.List(Combo1.ListIndex) = "奇" Then
TempCount(4) = 1
Else
TempCount(4) = 0
End If
For X = 1 To ListView1.ListItems.Count
If (Int(ListView1.ListItems.Item(X).SubItems(1)) + Int(ListView1.ListItems.Item(X).SubItems(2))) Mod 2 = TempCount(1) Then
ElseIf (Int(ListView1.ListItems.Item(X).SubItems(2)) + Int(ListView1.ListItems.Item(X).SubItems(3))) Mod 2 = TempCount(2) Then
ElseIf (Int(ListView1.ListItems.Item(X).SubItems(3)) + Int(ListView1.ListItems.Item(X).SubItems(4))) Mod 2 = TempCount(3) Then
ElseIf (Int(ListView1.ListItems.Item(X).SubItems(4)) + Int(ListView1.ListItems.Item(X).SubItems(5))) Mod 2 = TempCount(4) Then
Else
ListView1.ListItems.Remove X
End If
Next X
Dim X As Long, mCount As Long
Dim TempCount(1 To 4) As Long
If Combo1.List(Combo1.ListIndex) = "奇" Then
TempCount(1) = 1
Else
TempCount(1) = 0
End If
If Combo2.List(Combo2.ListIndex) = "奇" Then
TempCount(2) = 1
Else
TempCount(2) = 0
End If
If Combo3.List(Combo3.ListIndex) = "奇" Then
TempCount(3) = 1
Else
TempCount(3) = 0
End If
If Combo4.List(Combo4.ListIndex) = "奇" Then
TempCount(4) = 1
Else
TempCount(4) = 0
End If
For X = 1 To ListView1.ListItems.Count
If (Int(ListView1.ListItems.Item(X).SubItems(1)) + Int(ListView1.ListItems.Item(X).SubItems(2))) Mod 2 = TempCount(1) Then
ElseIf (Int(ListView1.ListItems.Item(X).SubItems(2)) + Int(ListView1.ListItems.Item(X).SubItems(3))) Mod 2 = TempCount(2) Then
ElseIf (Int(ListView1.ListItems.Item(X).SubItems(3)) + Int(ListView1.ListItems.Item(X).SubItems(4))) Mod 2 = TempCount(3) Then
ElseIf (Int(ListView1.ListItems.Item(X).SubItems(4)) + Int(ListView1.ListItems.Item(X).SubItems(5))) Mod 2 = TempCount(4) Then
Else
ListView1.ListItems.Remove X
End If
Next X
Dim X As Long, Y As Long, mCount As Long
Dim TempCount(1 To 4) As Long
For X = 1 To 4
If Combo1.List(X - 1) = "奇" Then
TempCount(X) = 1
Else
TempCount(X) = 0
End If
Next X
For X = 1 To ListView1.ListItems.Count
mCount = 0
For Y = 1 To 4
If (Int(ListView1.ListItems.Item(X).SubItems(Y)) + Int(ListView1.ListItems.Item(X).SubItems(Y + 1))) Mod 2 <> TempCount(Y) Then
mCount = 1
Exit For
End If
Next Y
If mCount = 1 Then ListView1.ListItems.Remove X
Next X
Dim X As Long, Y As Long, mCount As Long
Dim TempCount(1 To 4) As Long
For X = 1 To 4
If Combo1(X - 1).List(Combo1(X - 1).ListIndex) = "奇" Then
TempCount(X) = 1
Else
TempCount(X) = 0
End If
Next X
For X = 1 To ListView1.ListItems.Count
mCount = 0
For Y = 1 To 4
If (Int(ListView1.ListItems.Item(X).SubItems(Y)) + Int(ListView1.ListItems.Item(X).SubItems(Y + 1))) Mod 2 <> TempCount(Y) Then
mCount = 1
Exit For
End If
Next Y
If mCount = 1 Then ListView1.ListItems.Remove X
Next X
Dim X As Long, Y As Long, mCount As Long, myInfo() As String
Dim TempCount(1 To 4) As Long
For X = 1 To 4
If Combo1(X - 1).List(Combo1(X - 1).ListIndex) = "奇" Then
TempCount(X) = 1
Else
TempCount(X) = 0
End If
Next X
For X = 1 To ListView1.ListItems.Count
mCount = 0
For Y = 1 To 4
myInfo = Split(ListView1.ListItems.Item(X).Text, ",")
If (Int(myInfo(Y - 1)) + Int(myInfo(Y))) Mod 2 <> TempCount(Y) Then
mCount = 1
Exit For
End If
Next Y
If mCount = 1 Then ListView1.ListItems.Remove X
Next X
Dim X As Long, Y As Long, mCount As Long, myInfo() As String
Dim TempCount(1 To 4) As Long
For X = 1 To 4
If Combo1(X - 1).List(Combo1(X - 1).ListIndex) = "奇" Then
TempCount(X) = 1
Else
TempCount(X) = 0
End If
Next X
For X = 1 To ListView1.ListItems.Count
mCount = 0
For Y = 1 To 4
If ListView1.ListItems.Item(X) Is Nothing = True Then
Exit For
Else
myInfo = Split(ListView1.ListItems.Item(X).Text, ",")
If (Int(myInfo(Y - 1)) + Int(myInfo(Y))) Mod 2 <> TempCount(Y) Then
mCount = 1
Exit For
End If
End If
Next Y
If mCount = 1 Then ListView1.ListItems.Remove X: X = X - 1
Next X
Dim X As Long, Y As Long, mCount As Long, myInfo() As String
Dim TempCount(1 To 4) As Long, NowObj As ListItem
For X = 1 To 4
If Combo20(X - 1).List(Combo20(X - 1).ListIndex) = "奇数" Then
TempCount(X) = 1
Else
TempCount(X) = 0
End If
Next X
For X = 1 To ListView1.ListItems.Count
mCount = 0
On Error Resume Next
Set NowObj = ListView1.ListItems.Item(X)
If Err.Number <> 0 Then
Set NowObj = Nothing
Err.Clear
Exit For
End If
If NowObj Is Nothing <> True Then
For Y = 1 To 4
myInfo = Split(NowObj.Text, ",")
If (Int(myInfo(Y - 1)) + Int(myInfo(Y))) Mod 2 <> TempCount(Y) Then
mCount = 1
Exit For
End If
Next Y
If mCount = 1 Then ListView1.ListItems.Remove X: X = X - 1
End If
Next X