Hello
This is my original code and it works fine.
Code:
For x = playerCardsValue.Count - 1 To 1 Step -1
For y = x - 1 To 0 Step -1
If playerCardsValue(x) = playerCardsValue(y) Then
removePlayer(playerCards, playerCardsValue, x)
removePlayer(playerCards, playerCardsValue, y)
x -= 1
Exit For
End If
Next
Next
For x = computerCardsValue.Count - 1 To 1 Step -1
For y = x - 1 To 0 Step -1
If computerCardsValue(x) = computerCardsValue(y) Then
removePlayer(computerCards, computerCardsValue, x)
removePlayer(computerCards, computerCardsValue, y)
x -= 1
Exit For
End If
Next
Next
Private Sub removePlayer(listString As List(Of String), listInteger As List(Of Integer), x As Integer)
listString.RemoveAt(x)
listInteger.RemoveAt(x)
End Sub
So... I want to change it! I did and now it does not work!
Code:
Private Sub abc(ByRef listinteger As List(Of Integer), ByRef listString As List(Of String))
For x = listinteger.Count - 1 To 1 Step -1
For y = x - 1 To 0 Step -1
If listString(x) = listString(y) Then
removePlayer(listString, listinteger, x)
removePlayer(listString, listinteger, y)
x -= 1
Exit For
End If
Next
Next
End Sub
Private Sub Buttonremovepairs_Click(sender As System.Object, e As System.EventArgs) Handles Buttonremovepairs.Click
Buttonremovepairs.Enabled = False
abc(playerCardsValue, playerCards)
abc(computerCardsValue, computerCards)
Private Sub removePlayer(listString As List(Of String), listInteger As List(Of Integer), x As Integer)
listString.RemoveAt(x)
listInteger.RemoveAt(x)
End Sub
My new code does not do anything. The problem seems to be in the passing of the passed list?