Results 1 to 23 of 23

Thread: Quick question. i Am a huge newb. please help, its easy!!

  1. #1

    Thread Starter
    Member
    Join Date
    Sep 2007
    Posts
    58

    Talking Quick question. i Am a huge newb. please help, its easy!!

    okkkkkkkkkkkkkkkk...

    So i made a Tic Tac Toe game for vb 2005, in a windows application.
    I need a play again button, i made a bar at the top with a play again button, but need the code for it. A classmate told me this...


    Code:
    me.(what ever you named the picbox)
    thats all i remember lol
    ending is = nothing
    How could i do this?

    this is my code for the play now button right now. (im not sure what the gamedone thing is there for)

    Code:
        Private Sub PlayAgainToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PlayAgainToolStripMenuItem.Click
    
    
    
    
            If GameDone = 1 Then
                GameDone = 0
            End If
    Thanks alot, please reply asap, im leaving soon and need this for tomrrow

    cya

  2. #2
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,106

    Re: Quick question. i Am a huge newb. please help, its easy!!

    I'm afraid that isn't even close to enough information to expect an answer. How do you play it the first time?
    My usual boring signature: Nothing

  3. #3

    Thread Starter
    Member
    Join Date
    Sep 2007
    Posts
    58

    Re: Quick question. i Am a huge newb. please help, its easy!!

    What do you mean?

    I have a Play now button.. and i need the proper code for my app to basically Loop.

    What info do you need more? my code?

    Code:
    Public Class Form1
        Public GameDone As Byte
    
        'Name: 435354
        'Date: January 20/ 08
        'Purpose: For this game you need 2 players. One will be assigned "X" and the other "O". your objective is to get threes "X's" or "O's" in a 3 squared column, row or diaganle.
    
    
        'Tic-Tac-Toe has been played until a winner or a draw is occured 
    
        Private Sub btnMoveMade_Click(ByVal sender As Object, _
        ByVal e As System.EventArgs) Handles btn00.Click, btn01.Click, _
        btn02.Click, btn10.Click, btn11.Click, btn12.Click, btn20.Click, _
        btn21.Click, btn22.Click
            Dim btnSquareClicked As Button = sender
            Static chrTTT(2, 2) As Char     'store player moves
            Static player As Char = "X"     'X goes first
    
            'Check for existing X or O
            If btnSquareClicked.Text <> Nothing Then
                MessageBox.Show("Invalid move.")
            Else
                'Show move
                btnSquareClicked.Text = player
    
                'Store move in chrTTT()
                Dim index As String
                index = btnSquareClicked.Tag
                Dim x As Integer = Val(index.Chars(0))
                Dim y As Integer = Val(index.Chars(2))
                Call StoreMove(x, y, player, chrTTT)
    
                'Check for winner
                If IsWinner(chrTTT) Then
                    MessageBox.Show("Game over!")
                Else                        'next player’s turn
                    If player = "X" Then
                        player = "O"
                    Else
                        player = "X"
                    End If
                End If
            End If
        End Sub
    
        'Store Tic-Tac-Toe move in chrTTT().
        '
        'pre: x and y is a valid index. chrTTT is a 3 x 3 array.
        'post: Tic-Tac-Toe move has been stored in chrTTT.
        '
        Sub StoreMove(ByVal x As Integer, ByVal y As Integer, _
        ByVal player As Char, ByRef TTT(,) As Char)
            TTT(x, y) = player
        End Sub
    
        'Determines if there is a winner.
        '
        'pre: chrTTT is a 3 x 3 array.
        'post: True has been returned if a winner is found 
        'or if all squares are filled.
        '
        Function IsWinner(ByRef TTT(,) As Char) As Boolean
            'Check all rows
            For row As Integer = 0 To 2
                If TTT(row, 0) = TTT(row, 1) And _
                TTT(row, 1) = TTT(row, 2) And _
                (TTT(row, 0) = "X" Or TTT(row, 0) = "O") Then
                    Return True     'winner
                End If
            Next row
    
            'Check all columns
            For col As Integer = 0 To 2
                If TTT(0, col) = TTT(1, col) And _
                TTT(1, col) = TTT(2, col) And _
                (TTT(0, col) = "X" Or TTT(0, col) = "O") Then
                    Return True     'winner
                End If
            Next col
    
            'Check one diagonal
            If TTT(0, 0) = TTT(1, 1) And TTT(1, 1) = TTT(2, 2) _
            And (TTT(0, 0) = "X" Or TTT(0, 0) = "O") Then
                Return True         'winner
            End If
    
            'Check other diagonal
            If TTT(0, 2) = TTT(1, 1) And TTT(1, 1) = TTT(2, 0) _
            And (TTT(0, 2) = "X" Or TTT(0, 2) = "O") Then
                Return True         'winner
            End If
    
            'Check for empty squares
            Dim movesLeft As Boolean = False
            For row As Integer = 0 To 2
                For col As Integer = 0 To 2
                    If TTT(row, col) = Nothing Then
                        movesLeft = True
                    End If
                Next col
            Next row
            If Not movesLeft Then
                Return True         'all squares filled
            End If
    
            Return False            'no winner found
        End Function
    
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    
        End Sub
    
        Private Sub QuitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles QuitToolStripMenuItem.Click
            Me.Close()
        End Sub
    
        Private Sub RulesToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RulesToolStripMenuItem.Click
            Dim Form1 As New Rules
            Form1.Visible = True
    
        End Sub
    
        Private Sub PlayAgainToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PlayAgainToolStripMenuItem.Click
     
    me.(PlayAgainToolStripMenuItem)
    
    
    
            If GameDone = 1 Then
                GameDone = 0
            End If
        End Sub
    End Class

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Quick question. i Am a huge newb. please help, its easy!!

    To us your game is a black box. If you say here's my black box with a Play Again button. Now how do I wire it up to play again? If we don't know anything about what's inside the black box then how can we tell you how to make it do anything?

    Now, playing again just means starting a new game. If you've already played one game then you've already started a new game so you should just be doing the same thing again.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5

    Thread Starter
    Member
    Join Date
    Sep 2007
    Posts
    58

    Re: Quick question. i Am a huge newb. please help, its easy!!

    ^^What? im confused lol.

    I would like it so that i can run it as a .exe and just press play again when the game is over.....

    Do you want me to upload my program to somthing and you can have a look at it, if its a black box?

    thanks

  6. #6
    New Member
    Join Date
    Jan 2008
    Location
    Valparaiso, IN
    Posts
    11

    Re: Quick question. i Am a huge newb. please help, its easy!!

    How about if you take a print screen of your GUI and post a picture for us, that might help.

    Do you need to keep the results of the previous game?

    It sounds to me like you might just need to clear the array that you store your moves in, and reset the buttons to their original state, this can be very easy.

  7. #7

    Thread Starter
    Member
    Join Date
    Sep 2007
    Posts
    58

    Re: Quick question. i Am a huge newb. please help, its easy!!

    Ok, here my array.

    Thanks for the help everyone


  8. #8
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,106

    Re: Quick question. i Am a huge newb. please help, its easy!!

    Looks like what you need to do is clear all the buttons by setting the captions to "", then clear the TTT array.
    My usual boring signature: Nothing

  9. #9

    Thread Starter
    Member
    Join Date
    Sep 2007
    Posts
    58

    Re: Quick question. i Am a huge newb. please help, its easy!!

    eekkkkkk... im unfamiliar with that.

    do you mind giving me a tiny step by step process in doing this?

    again, thanks a lot this is great

  10. #10
    New Member
    Join Date
    Jan 2008
    Location
    Valparaiso, IN
    Posts
    11

    Re: Quick question. i Am a huge newb. please help, its easy!!

    Try this

    vb Code:
    1. Private Sub PlayAgainToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PlayAgainToolStripMenuItem.Click
    2.  
    3.         Dim i As Integer
    4.         Dim ii As Integer
    5.  
    6.         For i = 0 To 2
    7.             For ii = 0 To 2
    8.                 chrTTT(i, ii) = ""
    9.             Next
    10.         Next
    11.  
    12.     btn00.text = ""
    13.     btn01.text = ""
    14.     btn02.text = ""
    15.     btn10.text = ""
    16.     btn11.text = ""
    17.     btn12.text = ""
    18.     btn20.text = ""
    19.     btn21.text = ""
    20.     btn22.text = ""
    21.  
    22.     player = "X"
    23. End Sub

  11. #11

    Thread Starter
    Member
    Join Date
    Sep 2007
    Posts
    58

    Re: Quick question. i Am a huge newb. please help, its easy!!

    Great. thanks for the code!!!

    Im still recieving an error...

    heres a pic. as you can see im getting the blue lines .



    thanks alot, this is great !

  12. #12
    PowerPoster
    Join Date
    Apr 2005
    Location
    Debug.Print
    Posts
    3,885

    Re: Quick question. i Am a huge newb. please help, its easy!!

    put your mouse over the wiggly line and itll tell you whats wrong ( as it says in the description at the bottom of the capture "its not declared"

    when it comes to
    vb Code:
    1. btn00.text = ""
    2.     btn01.text = ""
    3.     btn02.text = ""
    4.     btn10.text = ""
    5.     btn11.text = ""
    6.     btn12.text = ""
    7.     btn20.text = ""
    8.     btn21.text = ""
    9.     btn22.text = ""
    i always put that in a for each loop as its less code
    vb Code:
    1. for each ctrl as control in me.controls
    2. if typeof ctrl is button then
    3. ctrl.text = ""
    4. end if
    5. next ctrl

  13. #13

    Thread Starter
    Member
    Join Date
    Sep 2007
    Posts
    58

    Re: Quick question. i Am a huge newb. please help, its easy!!

    Thanks, it says both of them is not declared?
    What do i do for the Player one?

    And how do you use the loop your talking about?

    THANKS ALOT EVERYONE!!

  14. #14
    PowerPoster
    Join Date
    Apr 2005
    Location
    Debug.Print
    Posts
    3,885

    Re: Quick question. i Am a huge newb. please help, its easy!!

    chrtt is declared in btnMoveMade_Click as a static variable, it should be public at the top of the code form so then you can use it in all subs. if you declare it in a sub, its not available anywhere else and itll say its not declared. the for each loop is added to my post above.

  15. #15
    PowerPoster
    Join Date
    Apr 2005
    Location
    Debug.Print
    Posts
    3,885

    Re: Quick question. i Am a huge newb. please help, its easy!!

    Quote Originally Posted by fix23
    Thanks, it says both of them is not declared?
    you see it right in the screen shot you posted
    What do i do for the Player one?
    put both of these (remove from the sub too otherwise youll get an error saying its already declared) at the top of your code window and declare it public (will only be public for the form and not the whole app
    vb Code:
    1. Static chrTTT(2, 2) As Char     'store player moves
    2.         Static player As Char = "X"     'X goes first

  16. #16

    Thread Starter
    Member
    Join Date
    Sep 2007
    Posts
    58

    Re: Quick question. i Am a huge newb. please help, its easy!!

    Thanks alot man, thats helping greatly

    but i have a problem... i think i may be doing somthing wrong from the advie you guys are giving me... im still a newb to this and some of the stuff im still trying to figure out :P

    anyways... the first game works... and then when i click "Play Again" is goes to a new game.... which is good, excpet the first move i make (X) it right away says Game over!... then i cant play, i only have the option to use X and after every square i use it says Game over.

    Is there somthing i did wrong? i must have.

    do you want a pic of my code? which part?

    Thanks alot

    cya

  17. #17

    Thread Starter
    Member
    Join Date
    Sep 2007
    Posts
    58

    Re: Quick question. i Am a huge newb. please help, its easy!!

    arrrrrrrrg.. well i got a buddy to help me out and fixed a couple of things, but neither of us can fix the game over bug when the play again button it pressed.

    when you press play again and chose your first square it just says GAME OVER. which is not supposed to happen.

    Heres my code now. thanks

    Code:
    Public Class Form1
        Public chrTTT(2, 2) As Char     'store player moves
        Public player As Char = "X"     'X goes first 
    
        
        'Date: January 20/ 08
        'Purpose: For this game you need 2 players. One will be assigned "X" and the other "O". your objective is to get threes "X's" or "O's" in a 3 squared column, row or diaganle.
    
    
        Private Sub btnMoveMade_Click(ByVal sender As Object, _
        ByVal e As System.EventArgs) Handles btn00.Click, btn01.Click, _
        btn02.Click, btn10.Click, btn11.Click, btn12.Click, btn20.Click, _
        btn21.Click, btn22.Click
            Dim btnSquareClicked As Button = sender
            Static chrTTT(2, 2) As Char     'store player moves
            Static player As Char = "X"     'X goes first
    
            'Check for existing X or O
            If btnSquareClicked.Text <> Nothing Then
                MessageBox.Show("Invalid move.")
            Else
                'Show move
                btnSquareClicked.Text = player
    
                'Store move in chrTTT()
                Dim index As String
                index = btnSquareClicked.Tag
                Dim x As Integer = Val(index.Chars(0))
                Dim y As Integer = Val(index.Chars(2))
                Call StoreMove(x, y, player, chrTTT)
    
                'Check for winner
                If IsWinner(chrTTT) Then
                    MessageBox.Show("Game over! Click Menu > Play Again if you wish to play again!")
                Else                        'next player’s turn
                    If player = "X" Then
                        player = "O"
                        ToolStripStatusLabel1.Text = "It's player O's turn"
                    Else
                        player = "X"
                        ToolStripStatusLabel1.Text = "It's player X's turn"
                    End If
                End If
            End If
        End Sub
    
        'Store Tic-Tac-Toe move in chrTTT().
    
        Sub StoreMove(ByVal x As Integer, ByVal y As Integer, _
        ByVal player As Char, ByRef TTT(,) As Char)
            TTT(x, y) = player
        End Sub
    
        'Determines if there is a winner.
        'returned if a winner is found or if all squares are occupied.
    
        Function IsWinner(ByRef TTT(,) As Char) As Boolean
            'Check all rows
            For row As Integer = 0 To 2
                If TTT(row, 0) = TTT(row, 1) And _
                TTT(row, 1) = TTT(row, 2) And _
                (TTT(row, 0) = "X" Or TTT(row, 0) = "O") Then
                    Return True     'winner.
                End If
            Next row
    
            'Check all columns
            For col As Integer = 0 To 2
                If TTT(0, col) = TTT(1, col) And _
                TTT(1, col) = TTT(2, col) And _
                (TTT(0, col) = "X" Or TTT(0, col) = "O") Then
                    Return True     'winner
                End If
            Next col
    
            'Check one diagonal
            If TTT(0, 0) = TTT(1, 1) And TTT(1, 1) = TTT(2, 2) _
            And (TTT(0, 0) = "X" Or TTT(0, 0) = "O") Then
                Return True         'winner
            End If
    
            'Check other diagonal
            If TTT(0, 2) = TTT(1, 1) And TTT(1, 1) = TTT(2, 0) _
            And (TTT(0, 2) = "X" Or TTT(0, 2) = "O") Then
                Return True         'winner
            End If
    
            'Check for empty squares
            Dim movesLeft As Boolean = False
            For row As Integer = 0 To 2
                For col As Integer = 0 To 2
                    If TTT(row, col) = Nothing Then
                        movesLeft = True
                    End If
                Next col
            Next row
            If movesLeft = False Then
                Return True         'all squares filled
            End If
    
            Return False            'no winner found
        End Function
    
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    
        End Sub
    
        Private Sub QuitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles QuitToolStripMenuItem.Click
            Me.Close()
        End Sub
    
        Private Sub RulesToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RulesToolStripMenuItem.Click
            Dim NewRules As New Rules
            NewRules.ShowDialog()
        End Sub
        Private Sub PlayAgainToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PlayAgainToolStripMenuItem.Click
            ReDim chrTTT(2, 2)
            btn00.Text = ""
            btn01.Text = ""
            btn02.Text = ""
            btn10.Text = ""
            btn11.Text = ""
            btn12.Text = ""
            btn20.Text = ""
            btn21.Text = ""
            btn22.Text = ""
            player = "X"
        End Sub
    End Class

  18. #18
    Addicted Member garyjohn_2000's Avatar
    Join Date
    Apr 2005
    Location
    Timbaland
    Posts
    243

    Re: Quick question. i Am a huge newb. please help, its easy!!

    Try setting the Text property of each button to Nothing rather than "" in the PlayAgainToolStripMenuItem_Click eventhandler.
    vbcode Code:
    1. Private Sub PlayAgainToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PlayAgainToolStripMenuItem.Click
    2.         ReDim chrTTT(2, 2)
    3.         For Each ctrl As Control In Me.Controls
    4.             If TypeOf ctrl Is Button Then
    5.                 ctrl.Text = Nothing
    6.             End If
    7.         Next ctrl
    8.         player = "X"
    9.     End Sub

    Just a suggestion. Make a sub like "StartNewGame" and move the code you have in the PlayAgainToolStripMenuItem_Click eventhandler to that sub. Now you can call the sub from the Form_Load event and also the PlayAgainToolStripMenuItem_Click eventhandler to start a fresh game. This now becomes your generic "Cleanup" routine.

    Hope it helps,

    Peace!


    Anyone who has never made a mistake has never tried anything new. - Einstein
    Peace!

  19. #19

    Thread Starter
    Member
    Join Date
    Sep 2007
    Posts
    58

    Re: Quick question. i Am a huge newb. please help, its easy!!

    hey thanks alot man!!

    can you explain a little more bout that coding you said?

    this is my new code, is it right? how do i call the form? thanks

    also please add my msn. [email protected] i think yahoo people can still talk to me.
    thanks

    Code:
    Public Class Form1
        Public chrTTT(2, 2) As Char     'store player moves
        Public player As Char = "X"     'X goes first 
    
    
        'Date: January 20/ 08
        'Purpose: For this game you need 2 players. One will be assigned "X" and the other "O". your objective is to get threes "X's" or "O's" in a 3 squared column, row or diaganle.
    
    
        Private Sub btnMoveMade_Click(ByVal sender As Object, _
        ByVal e As System.EventArgs) Handles btn00.Click, btn01.Click, _
        btn02.Click, btn10.Click, btn11.Click, btn12.Click, btn20.Click, _
        btn21.Click, btn22.Click
            Dim btnSquareClicked As Button = sender
            Static chrTTT(2, 2) As Char     'store player moves
            Static player As Char = "X"     'X goes first
    
            'Check for existing X or O
            If btnSquareClicked.Text <> Nothing Then
                MessageBox.Show("Invalid move.")
            Else
                'Show move
                btnSquareClicked.Text = player
    
                'Store move in chrTTT()
                Dim index As String
                index = btnSquareClicked.Tag
                Dim x As Integer = Val(index.Chars(0))
                Dim y As Integer = Val(index.Chars(2))
                Call StoreMove(x, y, player, chrTTT)
    
                'Check for winner
                If IsWinner(chrTTT) Then
                    MessageBox.Show("Game over! Click Menu > Play Again if you wish to play again!")
                Else                        'next player’s turn
                    If player = "X" Then
                        player = "O"
                        ToolStripStatusLabel1.Text = "It's player O's turn"
                    Else
                        player = "X"
                        ToolStripStatusLabel1.Text = "It's player X's turn"
                    End If
                End If
            End If
        End Sub
    
        'Store Tic-Tac-Toe move in chrTTT().
    
        Sub StoreMove(ByVal x As Integer, ByVal y As Integer, _
        ByVal player As Char, ByRef TTT(,) As Char)
            TTT(x, y) = player
        End Sub
    
        'Determines if there is a winner.
        'returned if a winner is found or if all squares are occupied.
    
        Function IsWinner(ByRef TTT(,) As Char) As Boolean
            'Check all rows
            For row As Integer = 0 To 2
                If TTT(row, 0) = TTT(row, 1) And _
                TTT(row, 1) = TTT(row, 2) And _
                (TTT(row, 0) = "X" Or TTT(row, 0) = "O") Then
                    Return True     'winner.
                End If
            Next row
    
            'Check all columns
            For col As Integer = 0 To 2
                If TTT(0, col) = TTT(1, col) And _
                TTT(1, col) = TTT(2, col) And _
                (TTT(0, col) = "X" Or TTT(0, col) = "O") Then
                    Return True     'winner
                End If
            Next col
    
            'Check one diagonal
            If TTT(0, 0) = TTT(1, 1) And TTT(1, 1) = TTT(2, 2) _
            And (TTT(0, 0) = "X" Or TTT(0, 0) = "O") Then
                Return True         'winner
            End If
    
            'Check other diagonal
            If TTT(0, 2) = TTT(1, 1) And TTT(1, 1) = TTT(2, 0) _
            And (TTT(0, 2) = "X" Or TTT(0, 2) = "O") Then
                Return True         'winner
            End If
    
            'Check for empty squares
            Dim movesLeft As Boolean = False
            For row As Integer = 0 To 2
                For col As Integer = 0 To 2
                    If TTT(row, col) = Nothing Then
                        movesLeft = True
                    End If
                Next col
            Next row
            If movesLeft = False Then
                Return True         'all squares filled
            End If
    
            Return False            'no winner found
        End Function
    
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    
        End Sub
    
        Private Sub QuitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles QuitToolStripMenuItem.Click
            Me.Close()
        End Sub
    
        Private Sub RulesToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RulesToolStripMenuItem.Click
            Dim NewRules As New Rules
            NewRules.ShowDialog()
        End Sub
        Private Sub PlayAgainToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PlayAgainToolStripMenuItem.Click
            ReDim chrTTT(2, 2)
            For Each ctrl As Control In Me.Controls
                If TypeOf ctrl Is Button Then
                    ctrl.Text = Nothing
                End If
            Next ctrl
            player = "X"
        End Sub
    
        Sub StartNewGame()
            ReDim chrTTT(2, 2)
            btn00.Text = ""
            btn01.Text = ""
            btn02.Text = ""
            btn10.Text = ""
            btn11.Text = ""
            btn12.Text = ""
            btn20.Text = ""
            btn21.Text = ""
            btn22.Text = ""
            player = "X"
    
        End Sub
    
    End Class
    Last edited by fix23; Nov 8th, 2008 at 06:13 PM.

  20. #20
    Addicted Member garyjohn_2000's Avatar
    Join Date
    Apr 2005
    Location
    Timbaland
    Posts
    243

    Re: Quick question. i Am a huge newb. please help, its easy!!

    Declare StartNewGame() like :
    vbcode Code:
    1. Private Sub StartNewGame()
    2.     ReDim chrTTT(2, 2)
    3.     For Each ctrl As Control In Me.Controls
    4.         If TypeOf ctrl Is Button Then
    5.             ctrl.Text = Nothing
    6.         End If
    7.     Next ctrl
    8.     player = "X"
    9. End Sub

    Now you can use this routine to start a new game from any event.

    vbcode Code:
    1. Private Sub Form_Load (ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
    2.     StartNewGame()
    3. End Sub
    And also,
    vbcode Code:
    1. Private Sub PlayAgainToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PlayAgainToolStripMenuItem.Click
    2.     StartNewGame()
    3. End Sub

    Simplifies things, doesnt it?

    Peace!


    Anyone who has never made a mistake has never tried anything new. - Einstein
    Peace!

  21. #21

    Thread Starter
    Member
    Join Date
    Sep 2007
    Posts
    58

    Re: Quick question. i Am a huge newb. please help, its easy!!

    thanks! it does make things easyer.... except im still having the same problem


    when you press play again and chose your first square it just says GAME OVER. which is not supposed to happen.

  22. #22
    Addicted Member garyjohn_2000's Avatar
    Join Date
    Apr 2005
    Location
    Timbaland
    Posts
    243

    Re: Quick question. i Am a huge newb. please help, its easy!!

    I see that you have duplicate declarations.

    1. Public chrTTT(2, 2) As Char 'In Class Form1
    2. Static chrTTT(2, 2) As Char 'In Sub btnMoveMade_Click

    Remove the Static declaration in the sub btnMoveMade_Click and see if that helps.
    Last edited by garyjohn_2000; Jan 24th, 2008 at 03:20 AM.


    Anyone who has never made a mistake has never tried anything new. - Einstein
    Peace!

  23. #23

    Thread Starter
    Member
    Join Date
    Sep 2007
    Posts
    58

    Re: Quick question. i Am a huge newb. please help, its easy!!

    hmmm i get an error message wen i chose my first box then it highlights this dim in yello

    Code:
    Dim x As Integer = Val(index.Chars(0))
    aahhhhhhhhhhhhhhhhhhhhhh.. i gotta wake up in 3 hours for school.

    any other options hear?

    thnx alot

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width