Final Graded Project
You’ve been tasked to create an educational game for a fifthgrade
reading class. The game must test students’ spelling
skills using a variation of the classic game Hangman. If you’re
unfamiliar with the rules and general game play, please
consult the online reference at http://en.wikipedia.org/
wiki/Hangman_(game) for more information.
The application will use the HangManDB.MDF file. The
HangManDB database contains the tables shown in
The UnitID column in the Words table is a foreign key to the
ID column in the Units table. The Word column contains the
actual word to guess, while the Description column contains
the description of words for that unit.
The user interface will consist of a single Windows form. The
user interface will resemble Figure 60.
202 Final Graded Project
FIGURE 59—HangManDB Database Tables
When the application first loads, the textbox for the letter
guess should be disabled. If the New option is chosen in the
menu, then a new word and the unit description should be
loaded from the database. If the Quit option is chosen in the
menu, then the application should quit.
After each guess, one of two things should happen. If it was
a correct guess, then all occurrences of that letter should
appear in the labels at the bottom. If it’s an incorrect guess,
then the next stage of the hangman should appear in the
picture box. In either case, the textbox should highlight the
letter, so that the user can make another guess. The textbox
should not be cleared, or the user may attempt to guess the
same letter (Figure 61).
Final Graded Project 203
FIGURE 61—The incorrect
guessed letters should
appear in the picture box
and remain as other incorrect
guesses are added.
The game ends when either all letters of the
word are guessed correctly or the hangman
picture is completed. When the game is won,
a message box should display like this one
When the game is lost, the message box
should display words similar to Figure 63.
In either case, clicking the Yes button
should have the same effect as clicking the
New option in the menu and clicking the No
button should exit out of the application.
This will be the last graded project based on this scenario.
You’ll be graded on the end-user functionality, so variable
names and other aspects can differ, but the application must
work as intended.
This application will consist of the following files in the solution
1. GameForm.vb. The only form in the application.
2. HangmanDB.MDF. The database that contains the questions
and unit descriptions. See Provided Files section
below for more information.
3. Images folder. Hangman-0.png, Hangman-1.png,
Hangman-2.png, Hangman-3.png, Hangman-4.png,
Hangman-5.png, and Hangman-6.png. See “Provided
Files” section below for more information.
204 Final Graded Project
FIGURE 62—You won! Do you want to play
FIGURE 63—You lost. Do
you want to play again?
4. QuestionDataSet.xsd. The DataSet for the HangmanDB
database. Should contain both tables Words and Units.
You’ll be provided the following files:
■ The HangmanDB.MDF database
■ The images folder that contains the image files
Hangman-0.png, Hangman-1.png, Hangman-2.png,
Hangman-3.png, Hangman-4.png, Hangman-5.png,
You should add these files to your project as described in
step 3 in the Instructions section.
1. In Visual Studio, create a new Windows Forms project
2. Rename the Form1.vb file to GameForm.vb.
3. Add the provide files to your project. Use the Add >
Existing Item… option in the Solution Explorer. Make
sure in the Properties panel to set the Copy To Output
property to Copy Always.
4. Create the DataSet named QuestionDataSet.xsd using
the HangmanDB.MDF file. Review Assignment 15.
5. Create the user interface for GameForm.vb. See the
User Interface section above for the layout. The form
will consist of the following controls:
a. One MenuStrip control that contains the Game menu
with the options New and Quit.
b. One Label control with the text Guess a letter.
c. One Label control with the text Choose New Game.
This label will display the unit description during the
d. One TextBox control for the user type in letter
Final Graded Project 205
e. A PictureBox control that will display the hangman
images. You’ll set the ImageLocation property to load
the hangman images.
f. A Panel control that will contain the displayed letter
g. Eleven Label controls, one for each letter of the word.
These labels should be in the panel. You should set
the initial value for the Text property to the underscore
character (_) to act as a placeholder character.
You can chose to set the control properties to whatever
you like, but below are some helpful suggestions. If you
don’t name the controls the same names, you’ll need to
modify some provided code in the next steps.
For a further description on how to add and layout
controls, review Assignment 11 and Assignment 13.
6. In the code of GameForm.vb, you should define the
a. dsQuestions. A QuestionDataSet object
206 Final Graded Project
GameForm Size: 500, 500
Label for unit description (Name): lblUnitDescription
TextBox for letter guesses (Name): txtGuess
PictureBox for hangman images (Name): pboxHangman
Size: 256, 256
Panel for letter labels (Name): panelWord
Eleven Label controls for letters Set the (Name) property for
each to lblLetter0 to
lblLetter11. The last character(
s) will match the character
index in the word.
b. numWord. The index of which word is being guessed.
This matches the row in the Words table that’s being
retrieved. Each game will increment this number by
c. word. The actual word being guessed.
d. numWrongGuesses. Number of wrong guesses in a
e. numRightGuesses. Number of right guesses in a
f. gameStarted. Indicates whether the game has started
6. In the code of GameForm.vb, you should have the following
a. Form Load event handler—Disable the txtGuess
textbox, set the numWord variable and call the
LoadData method (provided below).
b. Quit button Click event handler—Exit the application
c. In the New button Click event handler, perform the
I. Initialize all variables, especially numRightGuesses,
numWrongGuesses, gameStarted, and
numWord. Make sure to increment numWord to
the next index.
II. Initialize controls. Clear the text of all labels,
enable and set the focus to the txtGuess textbox.
III. Set controls using the DataSet. If you followed
the same names, then you can use this code:
‘Gets word column row
word = CStr(dsQuestions.Words(numWord)(1))
‘Gets unit description
lblUnitDescription.Text = _
IV. Set the label control for each character in the
word. Set the Text property to the underscore
Final Graded Project 207
d. In the txtGuess textbox TextChanged event, perform
the following tasks:
I. Check if the game is started using the
II. Check to see if the word (word) contains the
III. If it does, then call the SetRightLetterLabels
method (provided below) and increment the
IV. If it doesn’t, set the image in the pboxHangman
and increment the numWrongGuesses variable.
Your code should resemble the following:
pboxHangman.ImageLocation = “images\Hangman-” &
numWrongGuesses & “.png”
numWrongGuesses += 1
V. Check to see if the game has been won or lost
yet. Use the CheckProgress method. See step 7A
for how the CheckProgress method is defined.
VI. Select all of the text in the txtGuess textbox.
7. In the code of GameForm.vb, you might find it helpful to
define the following methods:
a. A method named CheckProgress that calculates the
total number of tries (numRightGuesses +
numWrongGuesses), displays the correct message box
for winning or losing, and starts the next game or
exits the application depending on the message box
b. A method named WonGame that checks each letter in
the word is matched by its label and returns True if
this is the case.
c. A method named LostGame that checks to see if the
number of wrong guesses is greater than six and
returns True if this is the case.
d. A method named ResetAllLabels that sets each character
label to blank text.
208 Final Graded Project
8. In the code of the GameForm.vb, you might want to add
these helper methods:
Private Sub LoadData()
Dim taUnits As New
Dim taWords As New
Private Function FindLabel(ByVal i As Integer) As
‘Finds the right label in the Word panel
Dim label = panelWord.Controls.Find(“lblLetter” & i,
Private Sub SetRightLetterLabels(ByVal word As String,
ByVal ch As Char)
For i As Integer = 0 To word.Length – 1
‘Check for each letter and set the appropriate
If word.Chars(i) = ch Then
FindLabel(i).Text = ch
9. Save and run the application. Verify that all controls and
menus work correctly. You’ll submit the compiled application
for this project according to the submission
guidelines on that follow.
Final Graded Project 209
* You can also use 2CO option if you want to purchase through Credit Cards/Paypal but make sure you put the correct billing information otherwise you wont be able to receive any download link.
* Your paypal has to be pre-loaded in order to complete the purchase or otherwise please discuss it with us at [email protected].
* As soon as the payment is received, download link of the solution will automatically be sent to the address used in selected payment method.
* Please check your junk mails as the download link email might go there and please be patient for the download link email. Sometimes, due to server congestion, you may receive download link with a delay.
* All the contents are compressed in one zip folder.
* In case if you get stuck at any point during the payment process, please immediately contact us at [email protected] and we will fix it with you.
* We try our best to reach back to you on immediate basis. However, please wait for atleast 8 hours for a response from our side. Afterall, we are humans.
* Comments/Feedbacks are truely welcomed and there might be some incentives for you for the next lab/quiz/assignment.
* In case of any query, please donot hesitate to contact us at [email protected].
* MOST IMPORTANT Please use the tutorials as a guide and they need NOT to be used for any submission. Just take help from the material.
******************************************** Good Luck ***************************************************
Any personal information received will only be used to fill your order. We will not sell or redistribute your information to anyone.
We will try our best to resolve the issue and if still persists we can discuss for a refund in case its required.