Hiya, please can you help:
In my poker program I used to have loads of code for the 10 player slots, I used to ElseIf through each player in each player spot. Tonnes of code.
Now I want to loop through so I have only one set of code. The dropdown Boxes are called:
Player1, Player2, Player3, Player4, Player5, Player6, Player7, Player8, Player9, Player10
The problem I have is the correct code to replace the number after the word PLAYER.
ie: If Player(PlayX) = "YT" Then
There seems to be some syntax problem with the way I'm doing the Player(PlayX) bit.
Dim (PlayX) As Integer
For PlayX = 1 To 10
If Player(PlayX) = "YT" Then
Open "C:\Poker\yt.pok" For Input As #1
Input #1, PlayerName, TournamentGames, TotalGamesPlayed, Points, Member, gamebalance
Close #1
TotalGamesPlayed = TotalGamesPlayed + 1
gamebalance = gamebalance + playmoney
Open "C:\Poker\yt.pok" For Output As #1
Write #1, PlayerName, TournamentGames, TotalGamesPlayed, Points, Member, gamebalance
Close #1
Image3.Picture = Image4
ElseIf Player(PlayX) = "Morbid" Then
Open "C:\Poker\morbid.pok" For Input As #1
Input #1, PlayerName, TournamentGames, TotalGamesPlayed, Points, Member, gamebalance
Close #1
TotalGamesPlayed = TotalGamesPlayed + 1
gamebalance = gamebalance + playmoney
Open "C:\Poker\morbid.pok" For Output As #1
Write #1, PlayerName, TournamentGames, TotalGamesPlayed, Points, Member, gamebalance
Close #1
Image5.Picture = Image6
ElseIf Player(PlayX) = "Big Head" Then
Open "C:\Poker\bighead.pok" For Input As #1
Input #1, PlayerName, TournamentGames, TotalGamesPlayed, Points, Member, gamebalance
Close #1
TotalGamesPlayed = TotalGamesPlayed + 1
gamebalance = gamebalance + playmoney
Open "C:\Poker\bighead.pok" For Output As #1
Write #1, PlayerName, TournamentGames, TotalGamesPlayed, Points, Member, gamebalance
Close #1
Image20.Picture = Image19
ElseIf Player(PlayX) = "Woody" Then
Open "C:\Poker\woody.pok" For Input As #1
Input #1, PlayerName, TournamentGames, TotalGamesPlayed, Points, Member, gamebalance
Close #1
TotalGamesPlayed = TotalGamesPlayed + 1
gamebalance = gamebalance + playmoney
Open "C:\Poker\woody.pok" For Output As #1
Write #1, PlayerName, TournamentGames, TotalGamesPlayed, Points, Member, gamebalance
Close #1
Image7.Picture = Image8
ElseIf Player(PlayX) = "Dog" Then
Open "C:\Poker\dog.pok" For Input As #1
Input #1, PlayerName, TournamentGames, TotalGamesPlayed, Points, Member, gamebalance
Close #1
TotalGamesPlayed = TotalGamesPlayed + 1
gamebalance = gamebalance + playmoney
Open "C:\Poker\dog.pok" For Output As #1
Write #1, PlayerName, TournamentGames, TotalGamesPlayed, Points, Member, gamebalance
Close #1
ElseIf Player(PlayX) = "Darryl" Then
Open "C:\Poker\darryl.pok" For Input As #1
Input #1, PlayerName, TournamentGames, TotalGamesPlayed, Points, Member, gamebalance
Close #1
TotalGamesPlayed = TotalGamesPlayed + 1
gamebalance = gamebalance + playmoney
Open "C:\Poker\darryl.pok" For Output As #1
Write #1, PlayerName, TournamentGames, TotalGamesPlayed, Points, Member, gamebalance
Close #1
Image23.Picture = Image22
ElseIf Player(PlayX) = "E Honda" Then
Open "C:\Poker\ehonda.pok" For Input As #1
Input #1, PlayerName, TournamentGames, TotalGamesPlayed, Points, Member, gamebalance
Close #1
TotalGamesPlayed = TotalGamesPlayed + 1
gamebalance = gamebalance + playmoney
Open "C:\Poker\ehonda.pok" For Output As #1
Write #1, PlayerName, TournamentGames, TotalGamesPlayed, Points, Member, gamebalance
Close #1
ElseIf Player(PlayX) = "Bandit" Then
Open "C:\Poker\bandit.pok" For Input As #1
Input #1, PlayerName, TournamentGames, TotalGamesPlayed, Points, Member, gamebalance
Close #1
TotalGamesPlayed = TotalGamesPlayed + 1
gamebalance = gamebalance + playmoney
Open "C:\Poker\bandit.pok" For Output As #1
Write #1, PlayerName, TournamentGames, TotalGamesPlayed, Points, Member, gamebalance
Close #1
Image14.Picture = Image13
ElseIf Player(PlayX) = "Dyksey" Then
Open "C:\Poker\dyksey.pok" For Input As #1
Input #1, PlayerName, TournamentGames, TotalGamesPlayed, Points, Member, gamebalance
Close #1
TotalGamesPlayed = TotalGamesPlayed + 1
gamebalance = gamebalance + playmoney
Open "C:\Poker\dyksey.pok" For Output As #1
Write #1, PlayerName, TournamentGames, TotalGamesPlayed, Points, Member, gamebalance
Close #1
ElseIf Player(PlayX) = "Lucock" Then
Open "C:\Poker\lucock.pok" For Input As #1
Input #1, PlayerName, TournamentGames, TotalGamesPlayed, Points, Member, gamebalance
Close #1
TotalGamesPlayed = TotalGamesPlayed + 1
gamebalance = gamebalance + playmoney
Open "C:\Poker\lucock.pok" For Output As #1
Write #1, PlayerName, TournamentGames, TotalGamesPlayed, Points, Member, gamebalance
Close #1
Image10.Picture = Image9
ElseIf Player(PlayX) = "Stonch" Then
Open "C:\Poker\stonch.pok" For Input As #1
Input #1, PlayerName, TournamentGames, TotalGamesPlayed, Points, Member, gamebalance
Close #1
TotalGamesPlayed = TotalGamesPlayed + 1
gamebalance = gamebalance + playmoney
Open "C:\Poker\stonch.pok" For Output As #1
Write #1, PlayerName, TournamentGames, TotalGamesPlayed, Points, Member, gamebalance
Close #1
ElseIf Player(PlayX) = "Jason N" Then
Open "C:\Poker\jasonn.pok" For Input As #1
Input #1, PlayerName, TournamentGames, TotalGamesPlayed, Points, Member, gamebalance
Close #1
TotalGamesPlayed = TotalGamesPlayed + 1
gamebalance = gamebalance + playmoney
Open "C:\Poker\jasonn.pok" For Output As #1
Write #1, PlayerName, TournamentGames, TotalGamesPlayed, Points, Member, gamebalance
Close #1
Image34.Picture = Image35
ElseIf Player(PlayX) = "Jonsey" Then
Open "C:\Poker\jonsey.pok" For Input As #1
Input #1, PlayerName, TournamentGames, TotalGamesPlayed, Points, Member, gamebalance
Close #1
TotalGamesPlayed = TotalGamesPlayed + 1
gamebalance = gamebalance + playmoney
Open "C:\Poker\jonsey.pok" For Output As #1
Write #1, PlayerName, TournamentGames, TotalGamesPlayed, Points, Member, gamebalance
Close #1
Image26.Picture = Image24
ElseIf Player(PlayX) = "John D" Then
Open "C:\Poker\johnd.pok" For Input As #1
Input #1, PlayerName, TournamentGames, TotalGamesPlayed, Points, Member, gamebalance
Close #1
TotalGamesPlayed = TotalGamesPlayed + 1
gamebalance = gamebalance + playmoney
Open "C:\Poker\johnd.pok" For Output As #1
Write #1, PlayerName, TournamentGames, TotalGamesPlayed, Points, Member, gamebalance
Close #1
ElseIf Player(PlayX) = "Steve M" Then
Open "C:\Poker\stevem.pok" For Input As #1
Input #1, PlayerName, TournamentGames, TotalGamesPlayed, Points, Member, gamebalance
Close #1
TotalGamesPlayed = TotalGamesPlayed + 1
gamebalance = gamebalance + playmoney
Open "C:\Poker\stevem.pok" For Output As #1
Write #1, PlayerName, TournamentGames, TotalGamesPlayed, Points, Member, gamebalance
Close #1
ElseIf Player(PlayX) = "Hooter" Then
Open "C:\Poker\hooter.pok" For Input As #1
Input #1, PlayerName, TournamentGames, TotalGamesPlayed, Points, Member, gamebalance
Close #1
TotalGamesPlayed = TotalGamesPlayed + 1
gamebalance = gamebalance + playmoney
Open "C:\Poker\hooter.pok" For Output As #1
Write #1, PlayerName, TournamentGames, TotalGamesPlayed, Points, Member, gamebalance
Close #1
ElseIf Player(PlayX) = "David O'Keefe" Then
Open "C:\Poker\dokeefe.pok" For Input As #1
Input #1, PlayerName, TournamentGames, TotalGamesPlayed, Points, Member, gamebalance
Close #1
TotalGamesPlayed = TotalGamesPlayed + 1
gamebalance = gamebalance + playmoney
Open "C:\Poker\dokeefe.pok" For Output As #1
Write #1, PlayerName, TournamentGames, TotalGamesPlayed, Points, Member, gamebalance
Close #1
ElseIf Player(PlayX) = "Dave Martin" Then
Open "C:\Poker\davemartin.pok" For Input As #1
Input #1, PlayerName, TournamentGames, TotalGamesPlayed, Points, Member, gamebalance
Close #1
TotalGamesPlayed = TotalGamesPlayed + 1
gamebalance = gamebalance + playmoney
Open "C:\Poker\davemartin.pok" For Output As #1
Write #1, PlayerName, TournamentGames, TotalGamesPlayed, Points, Member, gamebalance
Close #1
ElseIf Player(PlayX) = "Mike" Then
Open "C:\Poker\mike.pok" For Input As #1
Input #1, PlayerName, TournamentGames, TotalGamesPlayed, Points, Member, gamebalance
Close #1
TotalGamesPlayed = TotalGamesPlayed + 1
gamebalance = gamebalance + playmoney
Open "C:\Poker\mike.pok" For Output As #1
Write #1, PlayerName, TournamentGames, TotalGamesPlayed, Points, Member, gamebalance
Close #1
Next PlayX
End If