03-05-2005, 04:35 PM
New to vb and i'm just posting around at places to see if i can get an answer to a question or two, and this seems like a very advanced place where posts are frequent so i hope i could receive some assistance. Very simple/newb question.
I'm attempting to take a word entered in a textbox, then display the exact same word in a label; however the word is displayed in asterix instead of the word itself. Not sure how to do this, help would be much appreciated.
03-05-2005, 04:36 PM
Label1.Caption = Text1.Text
how are you doing it.
03-05-2005, 04:50 PM
im not sure what your aim is.
do you know about the passwordchar property of the textbox ?
there is no passwordchar property for a label so what you could do is, when you want to fill the label with the word, put the actual word to a public variable and just fill the label with asterics to the length of the text. if you then need to work with the label, just call the variable.
the_textbox_string = Text1.Text
Label1.Caption = String(Len(Text1.Text), "*")
03-05-2005, 04:59 PM
well i'm attempting to create a game where the user guesses the textboxed word. Somewhat like hangman, except, there will be no consequences of a false guess.
03-05-2005, 05:14 PM
You can use a Text Box and set teh following properties:
BorderStyle = 0 - None
Locked = True
PasswordChar = *
you can also set the Enabled property to false so that the user can't even get focus to the Text Box, but then you'd probably want to put the textbox in some sort of container such as a picture box with BorderStyle = none and it's enabled property false but leave teh textbox's true, so that it'll keep it's original font color
03-05-2005, 05:25 PM
I'm probably going to go with the label method to display the asterix, but thanks for the alternative. Now i have to allow the user to guess a particular letter and see if it is contained in the textboxed word. Any Suggestions?
03-05-2005, 05:36 PM
what is the 'textboxed word' ??
03-05-2005, 06:50 PM
that doesn't make anysense then, if you're saying that the 'textboxed word' is waht the user inputs, and then you are wanting to check the guessed letter with the 'textboxed word' ... Please explain what you are wanting to do better
03-05-2005, 07:12 PM
so the user is playing against himself?
03-05-2005, 07:13 PM
mrjeffy321, we're a bit past that, read the above posts
03-05-2005, 07:13 PM
thanks, i'm essentially going to make this for like road trips in a car for little kids to kill time. Like one person enters word, then hands the laptop off to another.
03-05-2005, 07:15 PM
I sorry, I just quickly scanned through and didnt see a definite solution, I thought you were still on that.
[I deleted the previous post]
03-05-2005, 07:16 PM
ok, well after setting the label, you're going to want to keep the original word entered, so create a new variable to store it in. and then to check if the letter entered is in that String, us the InStr() function