hi I'm new to coding, I'm have a Visual Basic project for the memory game. it basically lets the player flips over 2 cards, if those 2 cards match, they disappear, if they don't, they flip back. the game end when all the cards disappear. I have completed the code but when I run it, it just let me flip the cards when I click; the matched cards didn't disappear, and when time out the msg box don't show up. I don't know what is wrong with my code, and Im new so I only use basic statement like if else, for next, do while,...and I use Visual Basic 2013
Please help this is my code:
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
lblEasyTime.Text = Val(lblEasyTime.Text) - 1
If lblEasyTime.Text = 0 Then Timer1.Enabled = False
End Sub
Sub check()
'Private Sub Easy_Load(sender As Object, e As EventArgs) Handles MyBase.Load
'Declare Variable
Dim imgCardback(5) As PictureBox
Dim imgCardfront(5) As PictureBox
Dim intGuesses As Integer
Dim intX As Integer
Dim intY As Integer
'Initialize variables
imgCardback(0) = imgJHeart
imgCardback(1) = imgJHeart2
imgCardback(2) = imgKHeart
imgCardback(3) = imgKHeart2
imgCardback(4) = imgQHeart
imgCardback(5) = imgQHeart2
imgCardfront(0) = imgCard1
imgCardfront(1) = imgCard2
imgCardfront(2) = imgcard3
imgCardfront(3) = imgcard4
imgCardfront(4) = imgcard5
imgCardfront(5) = imgcard6
intGuesses = 0
'Check images
For intX = 0 To 5
If imgCardfront(intX).Visible = False Then
For intY = 0 To 5
If imgCardfront(intY).Visible = False Then
If intX <> intY And imgCardback(intX).Tag = imgCardback(intY).Tag Then
imgCardback(intX).Visible = False
imgCardback(intY).Visible = False
imgCardfront(intX).Visible = False
imgCardfront(intY).Visible = False
intGuesses = intGuesses + 1
End If
If intX <> intY And imgCardback(intX).Tag <> imgCardback(intY).Tag And imgCardback(intX).Visible = True And imgCardback(intY).Visible = True Then
imgCardfront(intX).Visible = True
imgCardfront(intY).Visible = True
intGuesses = intGuesses + 1
End If
End If
Next
End If
Next
If imgCard1.Visible = False And imgCard1.Visible = False And imgCard1.Visible = False And imgCard1.Visible = False And imgCard1.Visible = False And imgCard1.Visible = False And imgJHeart.Visible = False And imgJHeart2.Visible = False And imgKHeart.Visible = False And imgKHeart2.Visible = False And imgQHeart.Visible = False And imgQHeart2.Visible = False Then
Me.Hide()
Congratulation.Visible = True
End If
Do While lblEasyTime.Text = 0
MsgBox("Times out!!! Better luck next time.")
Loop
End Sub
Private Sub imgCard1_Click(sender As Object, e As EventArgs) Handles imgCard1.Click
imgCard1.Visible = False
End Sub
Private Sub imgCard2_Click(sender As Object, e As EventArgs) Handles imgCard2.Click
imgCard2.Visible = False
End Sub
Private Sub imgcard3_Click(sender As Object, e As EventArgs) Handles imgcard3.Click
imgcard3.Visible = False
End Sub
Private Sub imgcard4_Click(sender As Object, e As EventArgs) Handles imgcard4.Click
imgcard4.Visible = False
End Sub
Private Sub imgcard5_Click(sender As Object, e As EventArgs) Handles imgcard5.Click
imgcard5.Visible = False
End Sub
Private Sub imgcard6_Click(sender As Object, e As EventArgs) Handles imgcard6.Click
imgcard6.Visible = False
End Sub