title: Line break in textbox
body: <p>I have textbox which should be used to send formatted text to remote application, and I should format it so it breaks on closest space to 30th character (spaces included) and that space on which line is broken, should be deleted, so it isn't taken to next row. And of course, it should do it to the end of the text (break, start counting again, break, and so on).
  -Other Thing is that characters for formatting text should be excluded from counting.
  I have solution, found here on SO, but it works for one row.</p>
  
  <pre><code>string sTemp = textBox1.Text.Substring(0, 30);
  sTemp = sTemp.Replace(" @A ", "");
  sTemp = sTemp.Replace("@A ", "");
  sTemp = sTemp.Replace(" @A", "");
  sTemp = sTemp.Replace("@A", "");
  
  sTemp = sTemp.Replace(" @B ", "");
  sTemp = sTemp.Replace("@B ", "");
  sTemp = sTemp.Replace(" @B", "");
  sTemp = sTemp.Replace("@B", "");
  
  int numberOfLeak = 30 - sTemp.Length;
  var x = 30 + numberOfLeak;
  if (textBox1.Text.Length &gt; x)
  {
      textBox1.Text = textBox1.Text.Insert(x, Environment.NewLine);
  } 
  </code></pre>
  
  <p>Can someone please help to make this work for many lines, until the end of text?</p>
  
  <p>Thanks in advance.</p>