amesjustin
Mar 5th, 2001, 01:18 AM
hey!
this is the prototype of the WinCheck function of my TicTacToe game. The labels (0-8) are the 9 squares you play on.
Function WeHaveAWinner() As Boolean
WeHaveAWinner = False
Dim strWinningCombo(7) As String
Do
strWinningCombo(0) = lblMove(0).Caption And lblMove(1).Caption And lblMove(2).Caption
strWinningCombo(1) = lblMove(3).Caption And lblMove(4).Caption And lblMove(5).Caption
strWinningCombo(2) = lblMove(6).Caption And lblMove(7).Caption And lblMove(8).Caption
strWinningCombo(3) = lblMove(0).Caption And lblMove(3).Caption And lblMove(6).Caption
strWinningCombo(4) = lblMove(1).Caption And lblMove(4).Caption And lblMove(7).Caption
strWinningCombo(5) = lblMove(2).Caption And lblMove(5).Caption And lblMove(8).Caption
strWinningCombo(6) = lblMove(0).Caption And lblMove(4).Caption And lblMove(8).Caption
strWinningCombo(7) = lblMove(2).Caption And lblMove(4).Caption And lblMove(6).Caption
If strWinningCombo() Is "XXX" Then
WeHaveAWinner = True
If strComputer = "X" Then
Call ComputerWin
Exit Function
End If
If strHuman = "X" Then
Call HumanWin
Exit Function
End If
Else:
If strWinningCombo() = "OOO" Then
WeHaveAWinner = True
If strComputer = "O" Then
Call ComputerWin
Exit Function
End If
If strHuman = "O" Then
Call HumanWin
Exit Function
End If
End If
End If
Loop Until (WeHaveAWinner = True) Or (Boardfull = True)
End Function
When it gets to the [If strWinningCombo() Is "XXX" Then] line it gets a "Type Mismatch" error on the "XXX".
I have tried at least 809 different configurations of this loop and this is the one error I cannot seem to figure out.
please help.
this is the prototype of the WinCheck function of my TicTacToe game. The labels (0-8) are the 9 squares you play on.
Function WeHaveAWinner() As Boolean
WeHaveAWinner = False
Dim strWinningCombo(7) As String
Do
strWinningCombo(0) = lblMove(0).Caption And lblMove(1).Caption And lblMove(2).Caption
strWinningCombo(1) = lblMove(3).Caption And lblMove(4).Caption And lblMove(5).Caption
strWinningCombo(2) = lblMove(6).Caption And lblMove(7).Caption And lblMove(8).Caption
strWinningCombo(3) = lblMove(0).Caption And lblMove(3).Caption And lblMove(6).Caption
strWinningCombo(4) = lblMove(1).Caption And lblMove(4).Caption And lblMove(7).Caption
strWinningCombo(5) = lblMove(2).Caption And lblMove(5).Caption And lblMove(8).Caption
strWinningCombo(6) = lblMove(0).Caption And lblMove(4).Caption And lblMove(8).Caption
strWinningCombo(7) = lblMove(2).Caption And lblMove(4).Caption And lblMove(6).Caption
If strWinningCombo() Is "XXX" Then
WeHaveAWinner = True
If strComputer = "X" Then
Call ComputerWin
Exit Function
End If
If strHuman = "X" Then
Call HumanWin
Exit Function
End If
Else:
If strWinningCombo() = "OOO" Then
WeHaveAWinner = True
If strComputer = "O" Then
Call ComputerWin
Exit Function
End If
If strHuman = "O" Then
Call HumanWin
Exit Function
End If
End If
End If
Loop Until (WeHaveAWinner = True) Or (Boardfull = True)
End Function
When it gets to the [If strWinningCombo() Is "XXX" Then] line it gets a "Type Mismatch" error on the "XXX".
I have tried at least 809 different configurations of this loop and this is the one error I cannot seem to figure out.
please help.