Results 1 to 13 of 13

Thread: Unmasking a string

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2002
    Posts
    6

    Angry Unmasking a string

    i have a masked word in a text box. i aslo have an array of 26 command buttons, with a letter of the alphabet on each of the buttons. i want to know how i could unmask a letter in the word in the txtbox if i click on one of the cmdLetters.

  2. #2
    Need-a-life Member Mc Brain's Avatar
    Join Date
    Apr 2000
    Location
    Buenos Aires, Argentina
    Posts
    6,808
    Can you be more specific?? We can not guess what's what you're doing.
    Emiliano F. Martín


    If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
    Encourage the person who helped you to keep doing it, and give him the points he deserves.


    MP3 Organizer: Freeware to logically organize all your MP3s.

  3. #3
    Hyperactive Member brenaaro's Avatar
    Join Date
    Sep 2001
    Location
    Montreal, Canada
    Posts
    391
    You mean like a hang-man type game?
    And I, for one, welcome our new insect overlords. I'd like to remind them as a trusted TV personality, I can be helpful in rounding up others to toil in their underground sugar caves.

  4. #4

    Thread Starter
    New Member
    Join Date
    Jun 2002
    Posts
    6

    re:

    ye kinda like hang man.

    in the form i have a text box. 26 command buttons (array 0 to 25). each of the command buttons have a letter of the alphabet on it. so it looks like i have a keyboard on the form.

    in the text box, there is a "word" and it is masked to look like "****".

    i want to know how i could make the "****" back to "word" when i click on the "w" "o" "r" "d" command buttons. so i need to know some sort of code where i could un-mask the "****" in the text box. you know what i mean?

  5. #5
    Need-a-life Member Mc Brain's Avatar
    Join Date
    Apr 2000
    Location
    Buenos Aires, Argentina
    Posts
    6,808
    If you have a different label for each letter (on the word), write each masked letter on its tag. Then, each time a key (command array) is preseed, loop among all fo your labels and check if their tags are the same as the letter. If any of them does, just turn its caption to the same value of its tag.
    Emiliano F. Martín


    If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
    Encourage the person who helped you to keep doing it, and give him the points he deserves.


    MP3 Organizer: Freeware to logically organize all your MP3s.

  6. #6

    Thread Starter
    New Member
    Join Date
    Jun 2002
    Posts
    6

    Red face re:

    i actually dont have any labels. the word itself is a string inside a textbox.

  7. #7
    Need-a-life Member Mc Brain's Avatar
    Join Date
    Apr 2000
    Location
    Buenos Aires, Argentina
    Posts
    6,808
    Then you will need to use the Mid$ function to change the "*" you want with the letter you want to show.
    Emiliano F. Martín


    If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
    Encourage the person who helped you to keep doing it, and give him the points he deserves.


    MP3 Organizer: Freeware to logically organize all your MP3s.

  8. #8

    Thread Starter
    New Member
    Join Date
    Jun 2002
    Posts
    6

    re:

    thanks..could you possibly give me an example of how i could do that? ive tried it and im doing it wrong...

  9. #9
    Need-a-life Member Mc Brain's Avatar
    Join Date
    Apr 2000
    Location
    Buenos Aires, Argentina
    Posts
    6,808
    Let's stick to what you're doing... you could learn from your mistakes. Post your code and we'll see it.
    Emiliano F. Martín


    If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
    Encourage the person who helped you to keep doing it, and give him the points he deserves.


    MP3 Organizer: Freeware to logically organize all your MP3s.

  10. #10

    Thread Starter
    New Member
    Join Date
    Jun 2002
    Posts
    6

    Thumbs down

    ive erased it, but it went something like -

    dim MyWord as string
    dim LetterPosition as integer

    Mid$(MyWord, LetterPosition, 1) = Chr(index + 65)


    'all this is under the cmdLetter_click

  11. #11
    Need-a-life Member Mc Brain's Avatar
    Join Date
    Apr 2000
    Location
    Buenos Aires, Argentina
    Posts
    6,808
    Try this:
    VB Code:
    1. Private Sub cmdLetter_click(Index As Integer)
    2.    Dim MyWord As String
    3.    Dim LetterPosition As Integer
    4.  
    5.    For LetterPosition = 1 To Len(WordToGuess)
    6.       If Mid$(WordToGuess, LetterPosition, 1) = Chr$(index + 65) Then
    7.          Mid$(MyWord, LetterPosition, 1) = Chr(index + 65)
    8.       End If
    9.    Next LetterPosition
    10. End Sub
    Emiliano F. Martín


    If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
    Encourage the person who helped you to keep doing it, and give him the points he deserves.


    MP3 Organizer: Freeware to logically organize all your MP3s.

  12. #12

    Thread Starter
    New Member
    Join Date
    Jun 2002
    Posts
    6

    Thumbs down

    nope...doesnt seem to want to do anything..

  13. #13
    Need-a-life Member Mc Brain's Avatar
    Join Date
    Apr 2000
    Location
    Buenos Aires, Argentina
    Posts
    6,808
    I guessed I should have said this WordToGuess should be s Public variable where you "saved" you want the user to guess
    Emiliano F. Martín


    If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
    Encourage the person who helped you to keep doing it, and give him the points he deserves.


    MP3 Organizer: Freeware to logically organize all your MP3s.

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