title: StartIndex cannot be less than zero Getting Error
body: <p>I have a button to delete the last line in a multi text box. It works so far, deletes everything in the last line just how I want. Here is the code for that</p>
  
  <pre><code>    private void Button1_Click(object sender, EventArgs e)
          {
              textbox1.Text = textbox1.Text.Remove(textbox.Text.LastIndexOf(Environment.NewLine));
              }
  </code></pre>
  
  <p>but if click that button one more time after everything is deleted from the textbox, i get an error saying </p>
  
  <p>StartIndex cannot be less than zero</p>
  
  <p>so i did this...</p>
  
  <pre><code>    private void Button1_Click(object sender, EventArgs e)
          {
            if (textbox1.Text == "")
              { }
  
              else 
              {
                  textbox1.Text = textbox1.Text.Remove(textbox1.Text.LastIndexOf(Environment.NewLine));
              }
  
          }
  </code></pre>
  
  <p>and it still lets me delete the last line... and the error occurs again.</p>
  
  <p>ANY SUGGESTIONS?</p>