title: Getting error IndexOutOfRangeException was unhandled
body: <p>I am trying to read text from sObj.txt &amp; write in MPadd.txt with some prefix text. The sObj.txt contains a vertical strip of words (1 in each line) &amp; the number of lines in this file are variable (determined by user). Here is the script that I am using:</p>
  
  <pre><code>Dim commands() =
      {
          "stmotd -a {0}",
          "stmotd -b 15 {0}"
      }
  
  
  Dim counter As Integer = 1
  Dim objLines = File.ReadAllLines("C:\temp\sObj.txt")
  
  Using SW As New IO.StreamWriter("c:\temp\MPadd.txt", True)
      For Each line in objLines
          SW.WriteLine(string.Format(commands(counter), line))
          counter += 1
      Next
  End Using
  </code></pre>
  
  <p>But when executed it returns error "IndexOutOfRangeException was unhandled" also says Index was outside the bounds of the array. Please help.</p>