anybloodyid
Member
- Joined
- Jan 25, 2018
- Messages
- 16
- Programming Experience
- Beginner
Hi and thanks for looking,
I followed a tutorial at microsoft on making a simple matching game after I finised I then started to adapt it so I could have a matching times table.
I have two TableLayoutPanels the first is populated with the questions 2 x 2 = etc
The second is populated with the answers 2, 4, 6, etc
The problem I have is when I click a question eg 2 x 4 = and then click the answer eg 8 it doesn't stay visible obviously these two lines of text do not match.
How can I add the answer to the question (not seen by player) but can be checked if it matches secondClicked.text.
Below is how I assignquestions to squares
I followed a tutorial at microsoft on making a simple matching game after I finised I then started to adapt it so I could have a matching times table.
I have two TableLayoutPanels the first is populated with the questions 2 x 2 = etc
The second is populated with the answers 2, 4, 6, etc
The problem I have is when I click a question eg 2 x 4 = and then click the answer eg 8 it doesn't stay visible obviously these two lines of text do not match.
If firstClicked.Text = secondClicked.Text Then
firstClicked = Nothing
secondClicked = Nothing
Exit Sub
End If
How can I add the answer to the question (not seen by player) but can be checked if it matches secondClicked.text.
Below is how I assignquestions to squares
Private Sub AssignQuestionsToSquares()
' The TableLayoutPanel has 12 labels,
' and the questions list has 12 questions,
' so an question is pulled at random from the list
' and added to each label
For Each control In TableLayoutPanel1.Controls
Dim questionLabel = TryCast(control, Label)
If questionLabel IsNot Nothing Then
Dim randomNumber = random.Next(questions.count)
questionLabel.Text = tableNumber & " x " & questions(randomNumber) & " = "
questionLabel.ForeColor = questionLabel.BackColor
questions.RemoveAt(randomNumber)
End If
Next
End Sub