title: VB 2010 - Replace all letters of a string with a dash
body: <p>VB 2010 - Beginner here, 
  I am creating a hangman game for a assignment and I am having trouble replacing the text of a string with dashes. I am not sure if I need to convert the string to a charArray() or if I can use the string.Replace function. i know i need to loop it unsure how..</p>
  
  <p>terribly confused i need some help. As I am learning please try and keep it simple with reason please.</p>
  
  <p>My sandbox code so far:</p>
  
  <pre><code>Imports System.IO
  
  Public Class Form1
  
      Private Const TEST = "test.txt"
  
      Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
  
          Dim WordString As String = Nothing
          Dim NewWordInteger As Integer
          Dim RandomWord As New Random(System.DateTime.Now.Millisecond) 'Load a new word at the time it was initiated
  
          'Load words from test file into the array 
          Dim WordArray() As String = File.ReadAllLines(TEST) 'Reads words from list and declares each as a string
          'Select Random word from the number of words in the dictionary.txt file
          NewWordInteger = RandomWord.Next(0, 4)
  
          'Display RandomWord in textbox as STRING.. 
          WordString = WordArray(NewWordInteger) ' Assigns wordstring a word from the arrany &amp; random by the NewWordInterger Substring.. 
          WordDisplayTextBox.Text = WordString ' will display the word in the textbox
          SolveLabel.Text = WordString ' will display the word in the Solve label
  
          'Will shoe the array word and the word/string position in the TEST.file
          ListBox1.Items.Add(WordString) ' will show the word
          ListBox2.Items.Add(NewWordInteger) ' will show the string position in the TEST.file
  
          'search string and replace letters with _ (Dashes)
          Dim charArray() As Char = WordDisplayTextBox.Text.ToCharArray
  
          For Each item As Char In WordDisplayTextBox.Text
              WordDisplayTextBox.Text = WordString.Replace(item, "_")
          Next
  
      End Sub
  
  End Class
  </code></pre>