title: For Each Item in ListBox1 do something then add item to listbox2 vb
body: <p>I made an app to convert certain numbers to other format<br>
  i.e</p>
  
  <blockquote>
    <ul>
    <li>1 = A</li>
    <li>2 = B</li>
    <li>3 = C</li>
    <li>4 = D</li>
    <li>5 = E</li>
    <li>ETC</li>
    </ul>
  </blockquote>
  
  <p>I have made that function with no problem and I have been using it for quite sometime, but now I would like to do things faster and in a batch.<br>
  So it's really difficult for me to copy from a text file to my Textbox1 then press button1 then copy textbox2 to other text file.  </p>
  
  <p>So I was thinking in loading the text file into a List Box then do a loop for each item in that list into a second list that I can export to another text file.</p>
  
  <p>The importing and exporting I have it covered but where I'm stuck at is to make the loop.</p>
  
  <p>Here's what I have please if you know a better way to do it let me know or tell me how to fix it this way.</p>
  
  <pre><code>Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
      Using FD As New OpenFileDialog()
          FD.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*"
          If FD.ShowDialog = Windows.Forms.DialogResult.OK Then
              ListBox1.Items.Clear()
              ListBox1.Items.AddRange(IO.File.ReadAllLines(FD.FileName))
          End If
      End Using
  End Sub
  
  
  Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
      Do
      Dim Item As String = ""
      For Each i As String In ListBox1.Items
          Item &amp;= i
          TextBox1.Text = Item
          TextBox2.Text = MYFUNCTION(TextBox1.Text)
          ListBox2.Items.Add(TextBox2.Text)
          TextBox1.Text = ""
          TextBox2.Text = ""
      Next
      Loop Until TextBox1.Text = "END"
  
  End Sub
  
  Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
      'TextBox2.Text = MeidHexToDec(TextBox1.Text)
  
      Using FD As New SaveFileDialog()
          FD.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*"
          If FD.ShowDialog = Windows.Forms.DialogResult.OK Then
              Dim FileContent As String = ""
              For Each i As String In ListBox2.Items
                  FileContent &amp;= i &amp; vbCrLf
              Next
              IO.File.WriteAllText(FD.FileName, FileContent)
          End If
      End Using
  End Sub
  </code></pre>
  
  <p>So my final aim is to do something like this:  </p>
  
  <p>TextFile1.txt  </p>
  
  <blockquote>
    <ul>
    <li>1</li>
    <li>2</li>
    <li>5</li>
    <li>5</li>
    <li>1</li>
    <li>3</li>
    <li>2</li>
    <li>END</li>
    </ul>
  </blockquote>
  
  <p>then after the conversion output </p>
  
  <p>TextFile2.txt </p>
  
  <blockquote>
    <ul>
    <li>A</li>
    <li>B</li>
    <li>E</li>
    <li>E</li>
    <li>A</li>
    <li>C</li>
    <li>B  </li>
    </ul>
  </blockquote>
  
  <p>The text file size will vary sometimes it will have only 10 items sometimes will be 50... 
  Thanks. </p>