Hi, so im making a Connect Four game, but im having trouble with the declaring the winner part. I have the pieces as back colors in picture boxes, but i cant figure out how to write the if statement saying if four picture boxes have the same back color.
for example i currently have:
Function Winner()
For rows = 0 To 5
For columns = 0 To 2
If picboxarray(rows, columns).BackColor = picboxarray(rows, columns + 1).BackColor And picboxarray(rows, columns + 1).BackColor = picboxarray(rows, columns + 2).BackColor And picboxarray(rows, columns + 2).BackColor And picboxarray(rows, columns + 3).BackColor And picboxarray(rows, columns).BackColor <> Nothing Then
Return True
End If
Next
Next
End Function
i get the error: Operator 'And' is not defined for types 'Boolean' and 'System.Drawing.Color'.
Any ideas on an alternative way? Thanks
for example i currently have:
Function Winner()
For rows = 0 To 5
For columns = 0 To 2
If picboxarray(rows, columns).BackColor = picboxarray(rows, columns + 1).BackColor And picboxarray(rows, columns + 1).BackColor = picboxarray(rows, columns + 2).BackColor And picboxarray(rows, columns + 2).BackColor And picboxarray(rows, columns + 3).BackColor And picboxarray(rows, columns).BackColor <> Nothing Then
Return True
End If
Next
Next
End Function
i get the error: Operator 'And' is not defined for types 'Boolean' and 'System.Drawing.Color'.
Any ideas on an alternative way? Thanks