Results 1 to 3 of 3

Thread: need help creating a loop

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2005
    Posts
    2

    need help creating a loop

    I am doing a hangman assignment , I need the application to display the correct amount of dashes"_" when player one enters his word. Here is my code so far. I was told I need to do a loop but I cannot figure it out for nothing.



    'get a 5-letter word from the first player
    Do
    word = InputBox("Enter a word", "Hangman Game")
    Loop Until word.Length = word.Length

    'convert to uppercase
    word = word.ToUpper()


    Me.uiWordLabel.Text = "_"

  2. #2
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: need help creating a loop

    Welcome to the forums!

    To convert to uppercase, in VB6, use Ucase()

    VB Code:
    1. word = Ucase(word)

    You don't need a loop if the user is inputting a whole word. Do you want them to input it one letter at a time? If so, then you would need a loop, and have some way of exiting it.

    I don't think you want a loop for the input.

  3. #3

    Thread Starter
    New Member
    Join Date
    Dec 2005
    Posts
    2

    Re: need help creating a loop

    Yes, they are putting in one letter at a time. That is what the assignment states. Maybe I need to clarify I need the wordlabel to show the same amount of dashes as the letters in the word that player 1 enters.
    Last edited by southman_70; Dec 3rd, 2005 at 12:43 PM.

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