Results 1 to 3 of 3

Thread: problem with hangman game

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 1999
    Location
    Morton, IL. usa
    Posts
    4

    Post

    I have a lbl that displays a string"_ _ _" for a word in a hangman game the only problem with the game is that when the letter replaces the "_" it dosen't disapeer it moves to the right. questio is cayou rogram a lbl for write over text or do i need to check something else?

  2. #2
    Lively Member
    Join Date
    Oct 1999
    Posts
    65

    Post

    Make a new form, don't name it.
    Add a label to it, don't name it.
    Add a command button, don't name it.
    Add a text box, don't name it.

    Go to the command button's code.

    Put this in there:

    '--------------------------------------------

    'Two variables for usage
    Dim newletter As String
    Dim oldcaption As String

    'Assign the label's caption to a variable, simple, huh?
    oldcaption = Label1.Caption

    'Assign the new letter to use, to a variable
    newletter = Mid(Text1.Text, 1, 1)

    'Now, rewrite the 1st "_" of the caption, with your
    'new letter.
    Mid(oldcaption, 1, 1) = newletter

    'Display the new word, in the caption of the old label
    Label1.Caption = oldcaption

    '--------------------------------------------

    The code is pretty simple. Hope it helps. If you have any further questions, I can probably answer them. As long as they're about text strings that is.

    ------------------
    "I'm carrying a Geometry book, but I'm not in Geometry...it's crazy...crazy man!"

  3. #3

    Thread Starter
    New Member
    Join Date
    Nov 1999
    Location
    Morton, IL. usa
    Posts
    4

    Post

    thanks Apollo,
    After pulling my hair out I foud out that the problem was in the code(Go Figure). the string was actually adding a "_" every time a letter was placed in it. it just looked like it was moving it over. I'm just learning
    you guys are great. thanks!!!!!!

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