Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27554

Visual Studio 2012 Question/Help

$
0
0
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

Viewing all articles
Browse latest Browse all 27554

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>