title: Removing common characters between two strings
body: <p>I'm trying to delete the common characters between two strings. My problem is that the for each loop is not deleting the correct characters between <code>strname</code> and <code>strname2</code>.</p>
  
  <pre><code>Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click, Button3.Click
  Dim strname, strname2 As String
  Dim r As Double
  strname = TextBox1.Text
  strname2 = TextBox2.Text
  For Each c As Char In strname
      If (strname2.IndexOf(c) &gt; -1) Then
          strname2 = strname2.Remove(strname2.IndexOf(c), 1)
          strname = strname.Remove(strname.IndexOf(c), 1)
      End If
  Next
  Dim result As Double = strname.Length + strname2.Length
  Label6.Text = result
  </code></pre>