-
Apr 15th, 2017, 09:52 AM
#1
Thread Starter
PowerPoster
[RESOLVED] Is it possible to hide some letters inside a label caption, but not all of them?
Hi there folks! I am working on a "figure out the missing word" game for Kindergarten students. What I would like to do is have a word in a label caption (and I have that) The words could be anywhere from 2 letters long to 8 letters. What I am trying to figure out is how to replace random letters in the caption with blank spaces or underscores, leaving only 1 letter showing.
I've used replace in the past, but only when replacing 1 specific characters with another specific character.
Would anyone know of an idea for this?
Thanks a lot!
-
Apr 15th, 2017, 10:16 AM
#2
Re: Is it possible to hide some letters inside a label caption, but not all of them?
I'd suggest using a separate string variable, modifying it as needed, then reassign that variable to the label's Caption property. You can change an individual letter in a string variable using Mid$(), i.e., change the 5th character to an underscore:
Code:
Mid$(strCaption, 5, 1) = "_"
-
Apr 15th, 2017, 11:52 AM
#3
Re: Is it possible to hide some letters inside a label caption, but not all of them?
An alternative to a label is to use an array of textboxes.
See the attached example where once you 'load' the word (I only load one: "TEACHER"), you click on any of the textboxes to show the first letter...then if the student doesn't guess correctly, click on another one...until the answer is completely shown.
Anyway, just another approach.
-
Apr 15th, 2017, 11:55 AM
#4
Re: Is it possible to hide some letters inside a label caption, but not all of them?
If you want to leave only one character visible and still remember the original you can simply set the caption to all underscores or whatever character you want to use.
You have your real string stored in a variable or if you want the tag of the label.
You would then use a combination of Rnd() and Len() to get a random character from your string and the Mid$ statement to place that character into the correct position of the label leaving all the others as underscores.
-
Apr 16th, 2017, 05:15 AM
#5
Re: Is it possible to hide some letters inside a label caption, but not all of them?
Morning, Justin...
Just for fun, I made a 'few' changes to the program I attached yesterday. Let's you show a form to the kids while you work on the main form, selecting the words (you'd need a second monitor to display the second form).
Anyway, it uses an array of textboxes, randomize (non-repeating random numbers) and a second form.
You might adapt this if you want.
Sam
-
Apr 16th, 2017, 07:25 AM
#6
Thread Starter
PowerPoster
Re: Is it possible to hide some letters inside a label caption, but not all of them?
Awesome awesome stuff! Thank you all for your help!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|