title: Extract middle name
body: <p>I need to find out how to extract the middle name from a full name to be displayed in an output text box, so far I can only get the middle name and half the last name to be displayed. The main issue I am having is I dont know how to get the indexOf the second space which seperates the middle and last name. Code so far:</p>
  
  <pre><code>Private Sub btnClick_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClick.Click
      Dim fullname, firstname, middlename, lastname As String
      Dim n, m As Integer
  
      fullname = txtFullName.Text
      n = fullname.IndexOf(" ")
      m = fullname.LastIndexOf(" ")
      firstname = fullname.Substring(0, n)
      lastname = fullname.Substring(m + 1)
      middlename = fullname.Substring(n, m)
      txtMiddleName.Text = middlename
  
  End Su
  </code></pre>