title: System.ArgumentOutOfRangeException: Index and length must refer to a location within the string
body: <p>When I am executing my code on visual studio it is working good, but when i execute my exe file, it is throwing an exception.</p>
  
  <pre><code>System.ArgumentOutOfRangeException: Index and length must refer to a location within the string.
  Parameter name: length
  at System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy)
  at System.String.Substring(Int32 startIndex, Int32 length)
   at QuoteExtractor.frmQuoteExtractor.cmdProcess_Click(Object sender, EventArgs e)
  </code></pre>
  
  <p>My code</p>
  
  <pre><code>    private void cmdProcess_Click(object sender, EventArgs e)
      {
          try
          {
  
              foreach (string line in rtfMain.Lines)
              {
                  try
                  {
                      if (line.Trim() != "")
                      {
                          if ((line != "") &amp;&amp; (line != " ") &amp;&amp; (line.Substring(0, 3) != "***") &amp;&amp; (line.Substring(0, 5) != "CUSIP"))
                          {
                              Quote q = new Quote();
                              q.Parse(line);
                              DisplayQuote(q);
                              QuoteList.Add(q);
                          }
                      }
                  }
  </code></pre>
  
  <p>Input:</p>
  
  <pre><code>   *** 9:30 AM ***    
     CUSIP          BOND NAME              SIZE       CURR FACE     TALK        COVER PX 
     004421GU1     ACE 2004-HE2 M2       10.000MM     1.103MM               dnt, 90 rsrv
     61744CTZ9     MSHEL 2005-3 M3       4.720MM      4.720MM               dnt
  </code></pre>