title: For Each Loop error: Collection was modified; enumeration operation might not execute
body: <p>I am encountering an error when looping through datarows. I searched SO and tried the solutions, but no luck.  </p>
  
  <p><strong>Collection was modified; enumeration operation might not execute.</strong></p>
  
  <pre><code>    Dim dRow As DataRow
      For Each dRow In dt.Rows
          dt.Rows.Add(dRow("CustNum"), dRow("SalesRepName"), dRow("mgrid"), "=""" &amp; dRow("midValue") &amp; """", dRow("dba"), dRow("sysDate"), dRow("statusID"))
      Next  
  </code></pre>
  
  <p>The error occurs the first time the code hits "<code>Next</code>"<br>
  What would be causing Collection was modified; enumeration operation might not execute.How can I resolve this error?</p>