Question
August 22, 2007 at 05:52 PM
polishthug

Replacing a full string in VB.net

by polishthug . Updated 19 years, 2 months ago

I have a hangman project to do for school and I can’t figure out how to parse through the whole string and replace it with a character like ” * ”

I wanna replace every character in the word with “*”. So far I only replaced the whole word with 1 character. There is some kind of forloop that I need and can’t seem to figure it out. Here is an example of what I have:

Dim OldText As String
Dim NewText As String
Dim letter As String = “*”

OldText = Me.lblA.Text
NewText = OldText.Replace(OldText, letter)
Me.lblA.Text = NewText

My lblA is connected to an access database where it randomly displays a question and an answer, but I want to hide the answer since it’s hangman.

Any help?

This discussion is locked

All Comments