For loop error in C#
<p>Im trying to run this for loop to fill a certain column in a datagrid view but give the error of "Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index"</p>

<pre><code>              for (int i = 0; i &lt; noofloops; i++)
              {
                  dgroute.Rows[i].Cells[0].Value ="Hey";
              }
</code></pre>

<p>I got some new addition info...here is the whole code what im really trying to do is that i want to get the date of the datepicker1 to datepicker2. ive subtract the date1 and date2 to get the difference to the 2 dates and for loop it in order to display all the specific date between date1 and date2 in the datagridview </p>

<pre><code> private void btnOK_Click(object sender, EventArgs e)
        {
              DateTime A = dtFrm.Value;
              DateTime B = dtTo.Value;
              TimeSpan ts = B - A;
              int days = ts.Days;




                  for (int i = 0; i &lt; dgroute.Rows.Count; i++)
                  {

                      dgroute.Rows[i].Cells[0].Value ="Hey";

                  }

              }
        }
</code></pre>
