| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Re: Need Help - NewbieNET |
From a post by Jeff Johnson:
"You have posted this question individually to
multiple groups. This is called Multiposting
and it's BAD. Replies made in one group will
not be visible in the other groups, which
may cause multiple people to respond to your
question with the same answer because they
didn't know someone else had already done it.
This is a waste of time.
If you MUST post your message to multiple
groups, post a single message and select all
the groups (or type their names manually,
separated by commas) in which you want it to
be seen. This is called Crossposting and when
used properly it is GOOD."
I've answered this question for you in one of your other postings.
Rick - MVP
"spirit of failure" wrote in message
news:eu7Kd.270$Pi.106{at}newsread3.news.atl.earthlink.net...
> Hi, I'm a VB newbie and I keep getting this error saying "If block
without
> End If". I have pored and pored over this code til I'm blue in the
face and
> I still see nothing wrong with it. I guess I need more eyes looking
at it.
> I hope you guys can help me. Your help will be greatly appreciated.
The
> function that the error appears in is posted below:
>
> Public Function CheckForWin()
> Dim liSquaresOccupied As Integer
>
> ' First, check for a win by the player
>
> If fbSquareX(0) = True And fbSquareX(1) = True And fbSquareX(2) =
True
> Then
> fbPlayerWon = True
> ElseIf fbSquareX(3) = True And fbSquareX(4) = True And fbSquareX(5)
= True
> Then
> fbPlayerWon = True
> ElseIf fbSquareX(6) = True And fbSquareX(7) = True And fbSquareX(8)
= True
> Then
> fbPlayerWon = True
> ElseIf fbSquareX(0) = True And fbSquareX(3) = True And fbSquareX(6)
= True
> Then
> fbPlayerWon = True
> ElseIf fbSquareX(1) = True And fbSquareX(4) = True And fbSquareX(7)
= True
> Then
> fbPlayerWon = True
> ElseIf fbSquareX(2) = True And fbSquareX(5) = True And fbSquareX(8)
= True
> Then
> fbPlayerWon = True
> ElseIf fbSquareX(0) = True And fbSquareX(4) = True And fbSquareX(8)
= True
> Then
> fbPlayerWon = True
> ElseIf fbSquareX(2) = True And fbSquareX(4) = True And fbSquareX(6)
= True
> Then
> fbPlayerWon = True
> End If
>
> ' Next, check for a win by the puter
>
> If fbSquareO(0) = True And fbSquareO(1) = True And fbSquareO(2) =
True
> Then
> fbComputerWon = True
> ElseIf fbSquareO(3) = True And fbSquareO(4) = True And fbSquareO(5)
= True
> Then
> fbComputerWon = True
> ElseIf fbSquareO(6) = True And fbSquareO(7) = True And fbSquareO(8)
= True
> Then
> fbComputerWon = True
> ElseIf fbSquareO(0) = True And fbSquareO(3) = True And fbSquareO(6)
= True
> Then
> fbComputerWon = True
> ElseIf fbSquareO(1) = True And fbSquareO(4) = True And fbSquareO(7)
= True
> Then
> fbComputerWon = True
> ElseIf fbSquareO(2) = True And fbSquareO(5) = True And fbSquareO(8)
= True
> Then
> fbComputerWon = True
> ElseIf fbSquareO(0) = True And fbSquareO(4) = True And fbSquareO(8)
= True
> Then
> fbComputerWon = True
> ElseIf fbSquareO(2) = True And fbSquareO(4) = True And fbSquareO(6)
= True
> Then
> fbComputerWon = True
> End If
>
> ' And last, check for a tie game
>
> If fbComputerWon = False And fbPlayerWon = False Then
> If fbSquareX(0) = True Or fbSquareO(0) = True Then
> liSquaresOccupied = liSquaresOccupied + 1
> End If
> If fbSquareX(1) = True Or fbSquareO(1) = True Then
> liSquaresOccupied = liSquaresOccupied + 1
> If fbSquareX(2) = True Or fbSquareO(2) = True Then
> liSquaresOccupied = liSquaresOccupied + 1
> If fbSquareX(3) = True Or fbSquareO(3) = True Then
> liSquaresOccupied = liSquaresOccupied + 1
> If fbSquareX(4) = True Or fbSquareO(4) = True Then
> liSquaresOccupied = liSquaresOccupied + 1
> If fbSquareX(5) = True Or fbSquareO(5) = True Then
> liSquaresOccupied = liSquaresOccupied + 1
> If fbSquareX(6) = True Or fbSquareO(6) = True Then
> liSquaresOccupied = liSquaresOccupied + 1
> If fbSquareX(7) = True Or fbSquareO(7) = True Then
> liSquaresOccupied = liSquaresOccupied + 1
> If fbSquareX(8) = True Or fbSquareO(8) = True Then
> liSquaresOccupied = liSquaresOccupied + 1
> End If
>
> ' If liSquaresOccupied = 9 (ass aquares are occupied) and neither
the
> puter nor
> ' the player has won, then we have a tie game.
>
> If liSquaresOccupied = 9 Then
> fbTie = True
> End If
> End If ' (fbComputerWon = False And fbPlayerWon = False)
>
> ' If a win or a tie has occurred, then increment a score.
> ' Turn off the timer and exit this routine
>
> If fbTie = True Or fbPlayerWon = True Or fbComputerWon = True Then
> CheckForWin = True
> If fbTie = True Then
> fiTieScore = fiTieScore + 1
> lblTie.Caption = fiTieScore
> lblStatus.Caption = "Tie game. Click start game to play again."
> fsWhoseTurnIsIt = "player"
> ElseIf fbPlayerWon = True Then
> fiPlayerScore = fiPlayerScore + 1
> lblPlayer.Caption = fiPlayerScore
> lblStatus.Caption = "Congratulations! You won! Click start
game to
> play again."
> fsWhoseTurnIsIt = "player"
> ElseIf fbComputerWon = True Then
> fiComputerScore = fiComputerScore + 1
> lblComputer.Caption = fiComputerScore
> lblStatus.Caption = "Sorry, the puter won. Click start game to
play
> again."
> fsWhoseTurnIsIt = "player"
> End If
>
> ' This part of the code does housekeeping by setting the game
> environment to that
> ' of a new game.
>
> cmdStart.Enabled = True
> fbTie = False
> fbPlayerWon = False
> fbComputerWon = False
>
> For i = 0 To 8
> fbSquareX(i) = False
> fbSquareO(i) = False
> Next i
>
> Timer1.Enabled = False
> Exit Function
> Else
> CheckForWin = False
> End If
>
> End Function
>
>
>
--- UseNet To RIME Gateway {at} 1/27/05 2:46:39 PM ---
* Origin: MoonDog BBS, Brooklyn,NY, 718 692-2498, 1:278/230 (1:278/230)SEEN-BY: 633/267 270 5030/786 @PATH: 278/230 10/345 106/1 2000 633/267 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.