title: VB.NET: Convert string containing "Lastname, Firstname" to "Firstname Lastname"
body: <p>I'm trying to convert a string that contains someones name as &quot;Last, First&quot; to &quot;First Last&quot;.</p>
  <p>This is how I am doing it now:</p>
  <pre><code>name = name.Trim
  name = name.Substring(name.IndexOf(&quot;,&quot;) + 1, name.Length) &amp; &quot; &quot; &amp; name.Substring(0, name.IndexOf(&quot;,&quot;) - 1)
  </code></pre>
  <p>When I do this I get the following error:</p>
  <blockquote>
  <p>ArgumentOutOfRangeException was unhandled</p>
  <p>Index and length must refer to  a location within the string</p>
  <p>Parameter name: length</p>
  </blockquote>
  <p>Can someone explain why I am getting this error and how I should be doing this?</p>