M
Michael MacDonald
I am writing a simple name game that shows the user a picture. The user
selects a radio button that corresponds to the pictures name and then
clicks the submit button. If the answer is correct 20 points is added
to the score and if the score is less than 100 and less than 7 photos
have been shown the game continues. Thei is a counter that keeps tracks
of how many pictures have been shown. Only 7 photos are allowed to be
shown. 100 points wins the game. So as you see the goal is to get 100
points before 7 photos are shown, each correct answer is worth 20
points. OK that out of the way here is my problem. When the user has
80 points and 6 pictures have been shown and you click the submit
button and get it right then the game hangs. It is as if it is thinking
"What do I do, the user has 100 points so he wins but he has been shown
7 photos so he loses. Here is my code. I know some of you guys hate it
when someone pastes a crap load of code in thses posts but the only way
anyone can help is if they see it all. Yes I am a newbie and yes this
is a school project and finally yes it would be awesome if anyone with
their vast knowledge could solve this riddle. Here is the code:
''' Set some global varibles''''''
'String Array Stores Answers
Dim m_strOptions As String() = New String() _
{"1", "2", "3", "4", "5", "6", "7", "8", "9", _
"10", "11", "12", "13", "14"}
'Boolean array that tracks used pictures
Dim m_blnUsed As Boolean() = New
Boolean(m_strOptions.GetUpperBound(0)) {}
Dim m_iPicked As Integer 'gets value from getuniquenumber() to use
in case
Dim m_intCounter As Integer = 1 'tallies how many photos shown
Dim m_strPicture As String 'current pictures name
Dim m_Score As Integer = 0 'keeping the score
'''Windows factory code stuff was removed from here'''''''
''''''''======= 1ST
======''''''''''''''''''''''''''''''*******************
Private Sub FrmFlagQuiz_Load(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles MyBase.Load
MessageBox.Show("Each correct answer equals 20 points and 100
points wins!!! You only get 7 trys, Good Luck!!!", "The Rules", _
MessageBoxButtons.OK, MessageBoxIcon.Information)
cbSel1.Text = ""
cbSel2.Text = ""
cbSel3.Text = ""
DisplayImage() 'go get the picture
'check what picture was selected and set up the answer grid
End Sub
'''''''''''''''''=============== 4TH ===========''''''''''''''
Function BuildPathName() As String
'begin with image name
Dim strOutput As String = m_strPicture
'throw image extension on string
strOutput &= ".jpg"
'add image location suffix
strOutput = strOutput.Insert(0,
System.Environment.CurrentDirectory _
& "\images\pic")
Return strOutput 'return full pathname
End Function
''''''''''''''''============== 3RD ======='''''''''''''''''''
Function GetUniqueRandomNumber() As Integer
Dim objRandom As Random = New Random 'new random
Dim intRandom As Integer 'represents result of random mix
'generate a random numbers unitl unused picture is found
Do
intRandom = objRandom.Next(0, m_blnUsed.Length)
Loop Until m_blnUsed(intRandom) = False 'look for unused images
m_blnUsed(intRandom) = True 'set subsc to true to indicate it has
been used
Return intRandom 'return subscript of image
' m_iPicked = intRandom 'set this for case to set up answer
End Function
'''''''''''''============ 2ND ======='''''''''''*************
'display random image in PictureBox
Sub DisplayImage()
'unique subscript ensures that a flag is used only once
Dim intRandom As Integer = GetUniqueRandomNumber()
'retreive picture name from array m_strOptions
m_strPicture = m_strOptions(intRandom)
Select Case m_strPicture
Case CStr(1)
cbSel1.Text = "Americas Best Friend"
cbSel2.Text = "Bill Clinton"
cbSel3.Text = "Tony Blair"
Case CStr(2)
cbSel1.Text = "Thomas Jefferson"
cbSel2.Text = "John Adams"
cbSel3.Text = "Paul Revere"
Case CStr(3)
cbSel1.Text = "Billy Blanks"
cbSel2.Text = "Philip Rivers"
cbSel3.Text = "Drew Brees"
Case CStr(4)
cbSel1.Text = "Cameron Diaz"
cbSel2.Text = "Courtney Love"
cbSel3.Text = "Super Hot Chick"
Case CStr(5)
cbSel1.Text = "Joe Schmo"
cbSel2.Text = "Tony Hamilton"
cbSel3.Text = "Will Ferrell"
Case CStr(6)
cbSel1.Text = "Aliens IV"
cbSel2.Text = "Burn Victim"
cbSel3.Text = "Michael Jackson"
Case CStr(7)
cbSel1.Text = "Jerome 'No means Yes' Jackson"
cbSel2.Text = "Kenyon 'I'll take it if I want it' King"
cbSel3.Text = "Kobe Bryant"
Case CStr(8)
cbSel1.Text = "John Kennedy III"
cbSel2.Text = "John Edwards"
cbSel3.Text = "King Arthur"
Case CStr(9)
cbSel1.Text = "Jose Offerman"
cbSel2.Text = "Sammy Sosa"
cbSel3.Text = "Juan Gonzalez"
Case CStr(10)
cbSel1.Text = "Superman"
cbSel2.Text = "Batman"
cbSel3.Text = "Spiderman"
Case CStr(11)
cbSel1.Text = "The Antichrist"
cbSel2.Text = "Joe 'Weapons of Mass Destruction' Smith"
cbSel3.Text = "George Bush"
Case CStr(12)
cbSel1.Text = "Jenny McCarthy"
cbSel2.Text = "Miss USA 2004"
cbSel3.Text = "Pamela Anderson"
Case CStr(13)
cbSel1.Text = "Cindy Crawford"
cbSel2.Text = "Laura Croft"
cbSel3.Text = "Angelina Jolie"
Case CStr(14)
cbSel1.Text = "Nicole Kidman"
cbSel2.Text = "Jenny Jones"
cbSel3.Text = "Sarah Gallagher"
Case Else
lblFeedback.Text = "System Error, Please blow up computer"
End Select
'get images pathname
Dim strPath As String = BuildPathName()
picImage.Image = Image.FromFile(strPath)
End Sub
Sub Clear()
lblFeedback.Text = "Wrong Awnser"
MessageBox.Show("Wrong Answer!!! Try Again", "Wrong Answer", _
MessageBoxButtons.OK, MessageBoxIcon.Warning)
DisplayImage()
btnNext.Enabled = False
lblFeedback.Text = ""
btnSubmit.Enabled = True
cbSel1.Checked = False
cbSel2.Checked = False
cbSel3.Checked = False
m_intCounter += 1
If m_intCounter >= 7 Then
MessageBox.Show(" Game Over!!! Only 7 photos are shown per
game", "Game Over", MessageBoxButtons.OK, _
MessageBoxIcon.Exclamation)
lblFeedback.Text = "Game Over!"
btnNext.Enabled = False
btnSubmit.Enabled = False
btnNewGame.Visible = True
btnNewGame.Enabled = True
lblScore.Text = "000"
End If
End Sub
'''''===== Clicking the Submit Button ===''''''''
Private Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSubmit.Click
If (cbSel1.Checked = False And cbSel2.Checked = False And
cbSel3.Checked = False) Then
MessageBox.Show("You must select an answer!!!", "Pick an
Answer", _
MessageBoxButtons.OK, MessageBoxIcon.Warning)
Exit Sub
End If
''''''===== Check the Awnser Selected and respond then adjust
score===='''''
Select Case m_strPicture
Case CStr(1)
If cbSel2.Checked = True Then
lblFeedback.Text = "You Are Correct!!!"
lblAwn.Text = "Bill Clinton"
m_Score += 20
lblScore.Text = CStr(m_Score)
Else : Clear()
Exit Sub
End If
Case CStr(2)
If cbSel1.Checked = True Then
lblFeedback.Text = "You Are Correct!!!"
lblAwn.Text = "Thomas Jefferson"
m_Score += 20
lblScore.Text = CStr(m_Score)
Else : Clear()
Exit Sub
End If
Case CStr(3)
If cbSel2.Checked = True Then
lblFeedback.Text = "You Are Correct!!!"
lblAwn.Text = "Philip Rivers"
m_Score += 20
lblScore.Text = CStr(m_Score)
Else : Clear()
Exit Sub
End If
Case CStr(4)
If cbSel1.Checked = True Then
lblFeedback.Text = "You Are Correct!!!"
lblAwn.Text = "Cameron Diaz"
m_Score += 20
lblScore.Text = CStr(m_Score)
Else : Clear()
Exit Sub
End If
Case CStr(5)
If cbSel3.Checked = True Then
lblFeedback.Text = "You Are Correct!!!"
lblAwn.Text = "Will Ferrell"
m_Score += 20
lblScore.Text = CStr(m_Score)
Else : Clear()
Exit Sub
End If
Case CStr(6)
If cbSel3.Checked = True Then
lblFeedback.Text = "You Are Correct!!!"
lblAwn.Text = "Michael Jackson"
m_Score += 20
lblScore.Text = CStr(m_Score)
Else : Clear()
Exit Sub
End If
Case CStr(7)
If cbSel3.Checked = True Then
lblFeedback.Text = "You Are Correct!!!"
lblAwn.Text = "Kobe Bryant"
m_Score += 20
lblScore.Text = CStr(m_Score)
Else : Clear()
Exit Sub
End If
Case CStr(8)
If cbSel2.Checked = True Then
lblFeedback.Text = "You Are Correct!!!"
lblAwn.Text = "John Edwards"
m_Score += 20
lblScore.Text = CStr(m_Score)
Else : Clear()
Exit Sub
End If
Case CStr(9)
If cbSel2.Checked = True Then
lblFeedback.Text = "You Are Correct!!!"
lblAwn.Text = "Sammy Sosa"
m_Score += 20
lblScore.Text = CStr(m_Score)
Else : Clear()
Exit Sub
End If
Case CStr(10)
If cbSel3.Checked = True Then
lblFeedback.Text = "You Are Correct!!!"
lblAwn.Text = "Spiderman"
m_Score += 20
lblScore.Text = CStr(m_Score)
Else : Clear()
Exit Sub
End If
Case CStr(11)
If cbSel3.Checked = True Then
lblFeedback.Text = "You Are Correct!!!"
lblAwn.Text = "George Bush"
m_Score += 20
lblScore.Text = CStr(m_Score)
Else : Clear()
Exit Sub
End If
Case CStr(12)
If cbSel2.Checked = True Then
lblFeedback.Text = "You Are Correct!!!"
lblAwn.Text = "Miss USA 2004"
m_Score += 20
lblScore.Text = CStr(m_Score)
Else : Clear()
Exit Sub
End If
Case CStr(13)
If cbSel3.Checked = True Then
lblFeedback.Text = "You Are Correct!!!"
lblAwn.Text = "Angelina Jolie"
m_Score += 20
lblScore.Text = CStr(m_Score)
Else : Clear()
Exit Sub
End If
Case CStr(14)
If cbSel1.Checked = True Then
lblFeedback.Text = "You Are Correct!!!"
lblAwn.Text = "Nicole Kidman"
m_Score += 20
lblScore.Text = CStr(m_Score)
Else : Clear()
Exit Sub
End If
'''' if wrong answer, let them know
Case Else
MessageBox.Show("Wrong Answer, Try Another One", _
"Wrong Answer", MessageBoxButtons.OK)
lblFeedback.Text = "Wrong Awnser!!!"
'display another image
DisplayImage()
End Select
'check if 7 or more pictures have been displayed if not keep
rolling
If m_intCounter >= 7 Then
If lblScore.Text = "100" Then
Exit Sub
End If
MessageBox.Show(" Game Over!!! Only 7 photos are shown per
game", "Game Over", MessageBoxButtons.OK, _
MessageBoxIcon.Exclamation)
lblFeedback.Text = "Game Over!"
btnNext.Enabled = False
btnSubmit.Enabled = False
btnNewGame.Visible = True
btnNewGame.Enabled = True
m_intCounter = 0
m_Score = 0
Else
btnSubmit.Enabled = False
btnNext.Enabled = True
End If
cbSel1.Checked = False
cbSel2.Checked = False
cbSel3.Checked = False
End Sub
Private Sub btnNext_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnNext.Click
DisplayImage()
cbSel1.Checked = False
cbSel2.Checked = False
cbSel3.Checked = False
lblAwn.Text = ""
lblFeedback.Text = ""
m_intCounter += 1
btnSubmit.Enabled = True
btnNext.Enabled = False
End Sub
''''===== Its a new Game, make the new game button visible and
'clean up text boxes and re-set score======''''
Private Sub btnNewGame_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles btnNewGame.Click
lblScore.Text = "000"
lblFeedback.Text = ""
DisplayImage()
btnSubmit.Enabled = True
btnNewGame.Visible = False
btnNext.Enabled = False
btnNext.Visible = True
m_intCounter = 0
m_Score = 0
End Sub
'''''====If the score is =to or greater than 100 game is over===''''
Private Sub lblScore_TextChanged(ByVal sender As Object, ByVal e As
System.EventArgs) Handles lblScore.TextChanged
If m_Score = 100 Then
lblFeedback.Text = "Game Over,You Win!!!"
m_Score = 0
m_intCounter = 0
lblScore.Text = "000"
btnNext.Enabled = False
btnNewGame.Visible = True
btnNewGame.Enabled = True
btnNext.Visible = False
btnSubmit.Enabled = False
Exit Sub
End If
End Sub
End Class ' TheNameGame
Mike_Mac
selects a radio button that corresponds to the pictures name and then
clicks the submit button. If the answer is correct 20 points is added
to the score and if the score is less than 100 and less than 7 photos
have been shown the game continues. Thei is a counter that keeps tracks
of how many pictures have been shown. Only 7 photos are allowed to be
shown. 100 points wins the game. So as you see the goal is to get 100
points before 7 photos are shown, each correct answer is worth 20
points. OK that out of the way here is my problem. When the user has
80 points and 6 pictures have been shown and you click the submit
button and get it right then the game hangs. It is as if it is thinking
"What do I do, the user has 100 points so he wins but he has been shown
7 photos so he loses. Here is my code. I know some of you guys hate it
when someone pastes a crap load of code in thses posts but the only way
anyone can help is if they see it all. Yes I am a newbie and yes this
is a school project and finally yes it would be awesome if anyone with
their vast knowledge could solve this riddle. Here is the code:
''' Set some global varibles''''''
'String Array Stores Answers
Dim m_strOptions As String() = New String() _
{"1", "2", "3", "4", "5", "6", "7", "8", "9", _
"10", "11", "12", "13", "14"}
'Boolean array that tracks used pictures
Dim m_blnUsed As Boolean() = New
Boolean(m_strOptions.GetUpperBound(0)) {}
Dim m_iPicked As Integer 'gets value from getuniquenumber() to use
in case
Dim m_intCounter As Integer = 1 'tallies how many photos shown
Dim m_strPicture As String 'current pictures name
Dim m_Score As Integer = 0 'keeping the score
'''Windows factory code stuff was removed from here'''''''
''''''''======= 1ST
======''''''''''''''''''''''''''''''*******************
Private Sub FrmFlagQuiz_Load(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles MyBase.Load
MessageBox.Show("Each correct answer equals 20 points and 100
points wins!!! You only get 7 trys, Good Luck!!!", "The Rules", _
MessageBoxButtons.OK, MessageBoxIcon.Information)
cbSel1.Text = ""
cbSel2.Text = ""
cbSel3.Text = ""
DisplayImage() 'go get the picture
'check what picture was selected and set up the answer grid
End Sub
'''''''''''''''''=============== 4TH ===========''''''''''''''
Function BuildPathName() As String
'begin with image name
Dim strOutput As String = m_strPicture
'throw image extension on string
strOutput &= ".jpg"
'add image location suffix
strOutput = strOutput.Insert(0,
System.Environment.CurrentDirectory _
& "\images\pic")
Return strOutput 'return full pathname
End Function
''''''''''''''''============== 3RD ======='''''''''''''''''''
Function GetUniqueRandomNumber() As Integer
Dim objRandom As Random = New Random 'new random
Dim intRandom As Integer 'represents result of random mix
'generate a random numbers unitl unused picture is found
Do
intRandom = objRandom.Next(0, m_blnUsed.Length)
Loop Until m_blnUsed(intRandom) = False 'look for unused images
m_blnUsed(intRandom) = True 'set subsc to true to indicate it has
been used
Return intRandom 'return subscript of image
' m_iPicked = intRandom 'set this for case to set up answer
End Function
'''''''''''''============ 2ND ======='''''''''''*************
'display random image in PictureBox
Sub DisplayImage()
'unique subscript ensures that a flag is used only once
Dim intRandom As Integer = GetUniqueRandomNumber()
'retreive picture name from array m_strOptions
m_strPicture = m_strOptions(intRandom)
Select Case m_strPicture
Case CStr(1)
cbSel1.Text = "Americas Best Friend"
cbSel2.Text = "Bill Clinton"
cbSel3.Text = "Tony Blair"
Case CStr(2)
cbSel1.Text = "Thomas Jefferson"
cbSel2.Text = "John Adams"
cbSel3.Text = "Paul Revere"
Case CStr(3)
cbSel1.Text = "Billy Blanks"
cbSel2.Text = "Philip Rivers"
cbSel3.Text = "Drew Brees"
Case CStr(4)
cbSel1.Text = "Cameron Diaz"
cbSel2.Text = "Courtney Love"
cbSel3.Text = "Super Hot Chick"
Case CStr(5)
cbSel1.Text = "Joe Schmo"
cbSel2.Text = "Tony Hamilton"
cbSel3.Text = "Will Ferrell"
Case CStr(6)
cbSel1.Text = "Aliens IV"
cbSel2.Text = "Burn Victim"
cbSel3.Text = "Michael Jackson"
Case CStr(7)
cbSel1.Text = "Jerome 'No means Yes' Jackson"
cbSel2.Text = "Kenyon 'I'll take it if I want it' King"
cbSel3.Text = "Kobe Bryant"
Case CStr(8)
cbSel1.Text = "John Kennedy III"
cbSel2.Text = "John Edwards"
cbSel3.Text = "King Arthur"
Case CStr(9)
cbSel1.Text = "Jose Offerman"
cbSel2.Text = "Sammy Sosa"
cbSel3.Text = "Juan Gonzalez"
Case CStr(10)
cbSel1.Text = "Superman"
cbSel2.Text = "Batman"
cbSel3.Text = "Spiderman"
Case CStr(11)
cbSel1.Text = "The Antichrist"
cbSel2.Text = "Joe 'Weapons of Mass Destruction' Smith"
cbSel3.Text = "George Bush"
Case CStr(12)
cbSel1.Text = "Jenny McCarthy"
cbSel2.Text = "Miss USA 2004"
cbSel3.Text = "Pamela Anderson"
Case CStr(13)
cbSel1.Text = "Cindy Crawford"
cbSel2.Text = "Laura Croft"
cbSel3.Text = "Angelina Jolie"
Case CStr(14)
cbSel1.Text = "Nicole Kidman"
cbSel2.Text = "Jenny Jones"
cbSel3.Text = "Sarah Gallagher"
Case Else
lblFeedback.Text = "System Error, Please blow up computer"
End Select
'get images pathname
Dim strPath As String = BuildPathName()
picImage.Image = Image.FromFile(strPath)
End Sub
Sub Clear()
lblFeedback.Text = "Wrong Awnser"
MessageBox.Show("Wrong Answer!!! Try Again", "Wrong Answer", _
MessageBoxButtons.OK, MessageBoxIcon.Warning)
DisplayImage()
btnNext.Enabled = False
lblFeedback.Text = ""
btnSubmit.Enabled = True
cbSel1.Checked = False
cbSel2.Checked = False
cbSel3.Checked = False
m_intCounter += 1
If m_intCounter >= 7 Then
MessageBox.Show(" Game Over!!! Only 7 photos are shown per
game", "Game Over", MessageBoxButtons.OK, _
MessageBoxIcon.Exclamation)
lblFeedback.Text = "Game Over!"
btnNext.Enabled = False
btnSubmit.Enabled = False
btnNewGame.Visible = True
btnNewGame.Enabled = True
lblScore.Text = "000"
End If
End Sub
'''''===== Clicking the Submit Button ===''''''''
Private Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSubmit.Click
If (cbSel1.Checked = False And cbSel2.Checked = False And
cbSel3.Checked = False) Then
MessageBox.Show("You must select an answer!!!", "Pick an
Answer", _
MessageBoxButtons.OK, MessageBoxIcon.Warning)
Exit Sub
End If
''''''===== Check the Awnser Selected and respond then adjust
score===='''''
Select Case m_strPicture
Case CStr(1)
If cbSel2.Checked = True Then
lblFeedback.Text = "You Are Correct!!!"
lblAwn.Text = "Bill Clinton"
m_Score += 20
lblScore.Text = CStr(m_Score)
Else : Clear()
Exit Sub
End If
Case CStr(2)
If cbSel1.Checked = True Then
lblFeedback.Text = "You Are Correct!!!"
lblAwn.Text = "Thomas Jefferson"
m_Score += 20
lblScore.Text = CStr(m_Score)
Else : Clear()
Exit Sub
End If
Case CStr(3)
If cbSel2.Checked = True Then
lblFeedback.Text = "You Are Correct!!!"
lblAwn.Text = "Philip Rivers"
m_Score += 20
lblScore.Text = CStr(m_Score)
Else : Clear()
Exit Sub
End If
Case CStr(4)
If cbSel1.Checked = True Then
lblFeedback.Text = "You Are Correct!!!"
lblAwn.Text = "Cameron Diaz"
m_Score += 20
lblScore.Text = CStr(m_Score)
Else : Clear()
Exit Sub
End If
Case CStr(5)
If cbSel3.Checked = True Then
lblFeedback.Text = "You Are Correct!!!"
lblAwn.Text = "Will Ferrell"
m_Score += 20
lblScore.Text = CStr(m_Score)
Else : Clear()
Exit Sub
End If
Case CStr(6)
If cbSel3.Checked = True Then
lblFeedback.Text = "You Are Correct!!!"
lblAwn.Text = "Michael Jackson"
m_Score += 20
lblScore.Text = CStr(m_Score)
Else : Clear()
Exit Sub
End If
Case CStr(7)
If cbSel3.Checked = True Then
lblFeedback.Text = "You Are Correct!!!"
lblAwn.Text = "Kobe Bryant"
m_Score += 20
lblScore.Text = CStr(m_Score)
Else : Clear()
Exit Sub
End If
Case CStr(8)
If cbSel2.Checked = True Then
lblFeedback.Text = "You Are Correct!!!"
lblAwn.Text = "John Edwards"
m_Score += 20
lblScore.Text = CStr(m_Score)
Else : Clear()
Exit Sub
End If
Case CStr(9)
If cbSel2.Checked = True Then
lblFeedback.Text = "You Are Correct!!!"
lblAwn.Text = "Sammy Sosa"
m_Score += 20
lblScore.Text = CStr(m_Score)
Else : Clear()
Exit Sub
End If
Case CStr(10)
If cbSel3.Checked = True Then
lblFeedback.Text = "You Are Correct!!!"
lblAwn.Text = "Spiderman"
m_Score += 20
lblScore.Text = CStr(m_Score)
Else : Clear()
Exit Sub
End If
Case CStr(11)
If cbSel3.Checked = True Then
lblFeedback.Text = "You Are Correct!!!"
lblAwn.Text = "George Bush"
m_Score += 20
lblScore.Text = CStr(m_Score)
Else : Clear()
Exit Sub
End If
Case CStr(12)
If cbSel2.Checked = True Then
lblFeedback.Text = "You Are Correct!!!"
lblAwn.Text = "Miss USA 2004"
m_Score += 20
lblScore.Text = CStr(m_Score)
Else : Clear()
Exit Sub
End If
Case CStr(13)
If cbSel3.Checked = True Then
lblFeedback.Text = "You Are Correct!!!"
lblAwn.Text = "Angelina Jolie"
m_Score += 20
lblScore.Text = CStr(m_Score)
Else : Clear()
Exit Sub
End If
Case CStr(14)
If cbSel1.Checked = True Then
lblFeedback.Text = "You Are Correct!!!"
lblAwn.Text = "Nicole Kidman"
m_Score += 20
lblScore.Text = CStr(m_Score)
Else : Clear()
Exit Sub
End If
'''' if wrong answer, let them know
Case Else
MessageBox.Show("Wrong Answer, Try Another One", _
"Wrong Answer", MessageBoxButtons.OK)
lblFeedback.Text = "Wrong Awnser!!!"
'display another image
DisplayImage()
End Select
'check if 7 or more pictures have been displayed if not keep
rolling
If m_intCounter >= 7 Then
If lblScore.Text = "100" Then
Exit Sub
End If
MessageBox.Show(" Game Over!!! Only 7 photos are shown per
game", "Game Over", MessageBoxButtons.OK, _
MessageBoxIcon.Exclamation)
lblFeedback.Text = "Game Over!"
btnNext.Enabled = False
btnSubmit.Enabled = False
btnNewGame.Visible = True
btnNewGame.Enabled = True
m_intCounter = 0
m_Score = 0
Else
btnSubmit.Enabled = False
btnNext.Enabled = True
End If
cbSel1.Checked = False
cbSel2.Checked = False
cbSel3.Checked = False
End Sub
Private Sub btnNext_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnNext.Click
DisplayImage()
cbSel1.Checked = False
cbSel2.Checked = False
cbSel3.Checked = False
lblAwn.Text = ""
lblFeedback.Text = ""
m_intCounter += 1
btnSubmit.Enabled = True
btnNext.Enabled = False
End Sub
''''===== Its a new Game, make the new game button visible and
'clean up text boxes and re-set score======''''
Private Sub btnNewGame_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles btnNewGame.Click
lblScore.Text = "000"
lblFeedback.Text = ""
DisplayImage()
btnSubmit.Enabled = True
btnNewGame.Visible = False
btnNext.Enabled = False
btnNext.Visible = True
m_intCounter = 0
m_Score = 0
End Sub
'''''====If the score is =to or greater than 100 game is over===''''
Private Sub lblScore_TextChanged(ByVal sender As Object, ByVal e As
System.EventArgs) Handles lblScore.TextChanged
If m_Score = 100 Then
lblFeedback.Text = "Game Over,You Win!!!"
m_Score = 0
m_intCounter = 0
lblScore.Text = "000"
btnNext.Enabled = False
btnNewGame.Visible = True
btnNewGame.Enabled = True
btnNext.Visible = False
btnSubmit.Enabled = False
Exit Sub
End If
End Sub
End Class ' TheNameGame
Mike_Mac