title: c# Split Strings Into Separate Text Boxes
body: <p>I am a beginner.  I have code to read in a text file, and part of how to get the strings into a text box.  The format of the text file is like DREC: 04HF; and then the next begins with that same format. I need to read that from the text file and split it into 2 separate text boxes (3,4) at a : or a ; . Thank you for the help.</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.ComponentModel;
  using System.Data;
  using System.Drawing;
  using System.Linq;
  using System.Text;
  using System.Threading.Tasks;
  using System.Windows.Forms;
  using System.IO;
  
  namespace WindowsFormsApplication8
  {
  public partial class Form1 : Form
  {
      public Form1()
      {
          InitializeComponent();
      }
  
      private void button1_Click(object sender, EventArgs e)
      {
          OpenFileDialog of = new OpenFileDialog();
          of.ShowDialog();
          textBox1.Text = of.FileName;
      }
  
      private void button2_Click(object sender, EventArgs e)
      {
          StreamReader sr = new StreamReader(textBox1.Text);
          textBox2.Text = sr.ReadToEnd();
          sr.Close();
      }
  
      private void button3_Click(object sender, EventArgs e)
      {
          int lcount;
          string s;
          int i;
          lcount = textBox2.Lines.Length;
          s = textBox2.Lines[0];
          for (i = 0; i &lt; lcount; i++)
          {
  
              textBox4.Text = textBox2.Lines[i];
          }
          textBox4.Text = s;
      }
  }
  </code></pre>