Results 1 to 18 of 18

Thread: HELP! Hangman Project Part 1

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2011
    Posts
    7

    Exclamation HELP! Hangman Project Part 1

    2. Display Form1.vb in design view.
    3. List the controls by the Name property and the control names, if any, that are not descriptive.
    4. Change the Text property of the form to "Hangman."
    5. Change the FormBorderStyle property to Fixed3D.
    6. Explain why the form should not be resizable.
    7. Change the Font of lblWord to Size 12 Bold.
    8. Reposition lblWord so that its left edge is aligned with the left edge of the PictureBox picBody (the box in the center of the form).
    9. Add code to the btnExit_Click event procedure to close the form, and exit the application by calling the form's Close method.
    10. Add code to the btnNew_Click event procedure to:
    •Display "??????? ?????" in lblWord.
    HINT: Use the Text property.
    •Set the value of the btnGuessL Enabled property to True, for example, btnGuessL.Enabled = True.
    •Set the value of the Enabled property for btnGuessW and btnSolve to True.
    11. Add code to the btnSolve_Click event procedure to display "BASSETT HOUND" in lblWord.
    12. Test your code.
    13. List the additional variables you think you will need in the program.
    14. Declare a form-level variable named strLetterGuessed as type String.
    15. Add code to the btnGuessL_Click event procedure to set the value of strLetterGuessed to the value in txtLetter.
    16. Test your code.
    17. Declare a form-level variable named strWordGuessed as type String.
    18. Add code to the btnGuessW_Click event procedure to set the value of strWordGuessed to the text entered in txtWord.
    19. Test your code.
    20. Open the file btnNew_Click.doc in your project start folder, and review the flowchart. This flowchart is for the completed btnNew_Click sub procedure. This is how the procedure will work by the end of the project. Why are the decisions shown in the flowchart not necessary at this point?

  2. #2
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,423

    Re: HELP! Hangman Project Part 1

    ok 19 steps. how far have you got?

  3. #3

    Thread Starter
    New Member
    Join Date
    Apr 2011
    Posts
    7

    Re: HELP! Hangman Project Part 1

    Hi
    I am in # 9 so far

  4. #4

    Thread Starter
    New Member
    Join Date
    Apr 2011
    Posts
    7

    Re: HELP! Hangman Project Part 1

    Hi
    I am in # 9 so far

  5. #5
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,423

    Re: HELP! Hangman Project Part 1

    where are the words you're guessing coming from?

  6. #6

    Thread Starter
    New Member
    Join Date
    Apr 2011
    Posts
    7

    Re: HELP! Hangman Project Part 1

    From a file I got from my course.

  7. #7
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,423

    Re: HELP! Hangman Project Part 1

    in #10 you need to select a word from your list, then set lblWord.text = new string("?"c,[your word].length)

  8. #8

    Thread Starter
    New Member
    Join Date
    Apr 2011
    Posts
    7

    Re: HELP! Hangman Project Part 1

    For #10 I need to select a word, I don't have a list with me. So this the part where I'm stuck.

  9. #9
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,423

    Re: HELP! Hangman Project Part 1

    just create a simple list in notepad. 1 word per line + work with that

  10. #10

    Thread Starter
    New Member
    Join Date
    Apr 2011
    Posts
    7

    Re: HELP! Hangman Project Part 1

    For # 20, Why are the decisions shown in the flowchart not necessary at this point? There's an attach file.
    Attached Files Attached Files

  11. #11
    PowerPoster Evil_Giraffe's Avatar
    Join Date
    Aug 2002
    Location
    Suffolk, UK
    Posts
    2,555

    Re: HELP! Hangman Project Part 1

    Quote Originally Posted by .paul. View Post
    in #10 you need to select a word from your list, then set lblWord.text = new string("?"c,[your word].length)
    Let's actually see about that, shall we?

    10. Add code to the btnNew_Click event procedure to:
    •Display "??????? ?????" in lblWord.
    HINT: Use the Text property.
    •Set the value of the btnGuessL Enabled property to True, for example, btnGuessL.Enabled = True.
    •Set the value of the Enabled property for btnGuessW and btnSolve to True.
    Hmm, don't see anything about selecting from a list there...

    The answer at this stage is hard-coded to be "BASSETT HOUND", as you can see from step 11. Someone else on these forums has been following these steps. Seeing these instructions makes certain things very clear.

    This is probably the worst way to go about writing a Hangman program that I can think of.

  12. #12
    PowerPoster Evil_Giraffe's Avatar
    Join Date
    Aug 2002
    Location
    Suffolk, UK
    Posts
    2,555

    Re: HELP! Hangman Project Part 1

    Quote Originally Posted by dreyes View Post
    For # 20, Why are the decisions shown in the flowchart not necessary at this point?
    Because it's a method of converting an arbitrary string to the '?' equivalent.
    [Edit: this is not the complete answer, just a pointer... why is the ability to convert an arbitrary string not necessary at this point?]

    A better question:


    For # 20, Why are the decisions shown in the flowchart not necessary at any point?
    Because it's a stupid method of converting an arbitrary string to the '?' equivalent.
    Last edited by Evil_Giraffe; Apr 3rd, 2011 at 07:17 PM.

  13. #13
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,423

    Re: HELP! Hangman Project Part 1

    Quote Originally Posted by Evil_Giraffe View Post
    Let's actually see about that, shall we?



    Hmm, don't see anything about selecting from a list there...
    oops. i only got as far as the second line in step 10

  14. #14
    PowerPoster Evil_Giraffe's Avatar
    Join Date
    Aug 2002
    Location
    Suffolk, UK
    Posts
    2,555

    Re: HELP! Hangman Project Part 1

    I am really seriously tempted to start my own "Program a Hangman app" beginners tutorial, focusing on what beginners actually need to know about programming in the OO paradigm with VB, instead of asking them to **** about with the WinForms designer and dump a load of procedural code in code-behind.

  15. #15
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,423

    Re: HELP! Hangman Project Part 1

    Quote Originally Posted by Evil_Giraffe View Post
    I am really seriously tempted to start my own "Program a Hangman app" beginners tutorial, focusing on what beginners actually need to know about programming in the OO paradigm with VB, instead of asking them to **** about with the WinForms designer and dump a load of procedural code in code-behind.
    __
    |
    |
    ------ B,A,D,etc... oh yeah, i get it

  16. #16

    Thread Starter
    New Member
    Join Date
    Apr 2011
    Posts
    7

    Re: HELP! Hangman Project Part 1

    Quote Originally Posted by Evil_Giraffe View Post
    Let's actually see about that, shall we?



    Hmm, don't see anything about selecting from a list there...

    The answer at this stage is hard-coded to be "BASSETT HOUND", as you can see from step 11. Someone else on these forums has been following these steps. Seeing these instructions makes certain things very clear.

    This is probably the worst way to go about writing a Hangman program that I can think of.
    Hi!!

    So far, this is what I have done with Part 1:
    Public Class frmMain
    Dim strLetterGuessed As String
    Dim strWordGuessed As String

    Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
    Close()
    End Sub

    Private Sub btnNew_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNew.Click
    lblWord.Text = "????????????"
    End Sub

    Private Sub btnSolve_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSolve.Click
    lblWord.Text = "BASSETT HOUND"
    End Sub

    Private Sub btnGuessL_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGuessL.Click
    txtLetter.Text = strLetterGuessed
    End Sub

    Private Sub btnGuessW_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGuessW.Click
    txtWord.Text = strWordGuessed
    End Sub
    End Class
    However, my professor said that I needed a few things. For instance, 1) btnNew_Click - needs the code to enable the objects mentioned in step 10. This is objectName.enabled = true, just use the name of the correct object mentioned 2) Your variable assignments need too be swapped . txtWord.Text = strWordGuessed should be strWordGuessed = txtWord.Text this goes for the other one as well.
    Can you please tell me what is exactly that I did wrong and what to correct? I'll appreciate your help. Thanks!

  17. #17
    PowerPoster Evil_Giraffe's Avatar
    Join Date
    Aug 2002
    Location
    Suffolk, UK
    Posts
    2,555

    Re: HELP! Hangman Project Part 1

    Quote Originally Posted by dreyes View Post
    Can you please tell me what is exactly that I did wrong and what to correct? I'll appreciate your help. Thanks!
    Your professor has already done this:

    Quote Originally Posted by dreyes View Post
    1) btnNew_Click - needs the code to enable the objects mentioned in step 10. This is objectName.enabled = true, just use the name of the correct object mentioned
    Step 10 says:

    10. Add code to the btnNew_Click event procedure to:
    •Display "??????? ?????" in lblWord.
    HINT: Use the Text property.
    •Set the value of the btnGuessL Enabled property to True, for example, btnGuessL.Enabled = True.
    •Set the value of the Enabled property for btnGuessW and btnSolve to True.

    (Emphasis mine)

    Quote Originally Posted by dreyes View Post
    2) Your variable assignments need too be swapped . txtWord.Text = strWordGuessed should be strWordGuessed = txtWord.Text this goes for the other one as well.
    He's referring to these two subs:

    vbnet Code:
    1. Private Sub btnGuessL_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGuessL.Click
    2.     txtLetter.Text = strLetterGuessed
    3. End Sub
    4.  
    5. Private Sub btnGuessW_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGuessW.Click
    6.     txtWord.Text = strWordGuessed
    7. End Sub

    These subs take the contents of txtLetter and txtWord respectively as inputs. What you need to do is assign the value of the Text property of the textboxes to the strLetterGuessed / strWordGuesssed variables. What is your code doing instead?

  18. #18
    PowerPoster Evil_Giraffe's Avatar
    Join Date
    Aug 2002
    Location
    Suffolk, UK
    Posts
    2,555

    Re: HELP! Hangman Project Part 1

    Oh, and:

    Quote Originally Posted by dreyes View Post
    Can you please tell me what is exactly that I did wrong and what to correct? I'll appreciate your help. Thanks!
    No, telling you exactly what you've done wrong and what to correct won't be of any use to you. You'll appreciate it more if we give you just enough assistance to solve it yourself.

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