title: Index was outside the bounds of the array [VB.NET]
body: <p>Hi i am new to VB and in the process of learning. This error occur sometimes and doesn't occur sometimes which i find it weird.
  I receive the error <code>Index was outside the bounds of the array</code>, that points to <code>Button30.Text = Split(newestversion, vbCrLf)(**1**)</code></p>
  
  <p>My motive is to read line by line from a online hosted text file.
  For example, </p>
  
  <pre><code>label1.text = line 1 of the text file
  label2.text = line 2 of the text file
  </code></pre>
  
  <p>This is very much what i want.</p>
  
  <p>Here is my current code (EDITED):</p>
  
  <pre><code>Dim request As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create("direct link to my online txt file")
  Dim response As System.Net.HttpWebResponse = request.GetResponse
  
  Dim sr As System.IO.StreamReader = New System.IO.StreamReader(response.GetResponseStream)
  
  Dim stringReader As String
  
          stringReader = sr.ReadLine()
          Button10.Text = stringReader
  
  
          Dim newestversion As String = sr.ReadToEnd
          Dim currentversion As String = Application.ProductVersion
  
          Dim part() As String = Split(newestversion, vbCrLf)
  
          If part.Length &lt; 10 Then
              ' not enough items in the array. You could also throw and exception or do some other stuff here
              Label10.Text = "beta"
              Exit Sub
          End If
  
  
          'updates new episode numbers on buttons
          Button20.Text = part(0)
          Button30.Text = part(1)
          Button40.Text = part(2)
          Button50.Text = part(3)
          Button60.Text = part(4)
          Button70.Text = part(5)
          Button80.Text = part(6)
          Button90.Text = part(7)
          Button100.Text = part(8)
          Button110.Text = part(9)
  
      End If
  </code></pre>
  
  <p>Thank You!!</p>