Error 'Object reference not set to an instance of an object.'
<p>Does anyone know where is my code going wrong here? This piece of code work perfectly fine but I transferred the file to another computer, this error popped out when I compile the file.</p>

<pre><code> private void ShowGeneratedSchedule(string sLocationName, string sAllocationDate)
    {
        //lstAllocation = db.allocations.Where(a =&gt; a.AllocationDate == sAllocationDate &amp;&amp;
        //    a.LocationName == sLocationName).ToList();

        scheduleDGV.EditMode = DataGridViewEditMode.EditProgrammatically;
        for (int i = 0; i &lt; lstAllocation.Count; i++)
        {
            for (int j = 0; j &lt; scheduleDGV.Rows.Count - 1; j++)
            {
                for (int k = 0; k &lt; scheduleDGV.Columns.Count; k++)
                {
                    if (scheduleDGV[0, j].Value.Equals(lstAllocation[i].LocationName) &amp;&amp;
                        scheduleDGV[1, j].Value.Equals(lstAllocation[i].StationName) &amp;&amp;
                        scheduleDGV.Columns[k].HeaderText.Equals(lstAllocation[i].AllocationTime.ToString()))
                    {
                        if (lstAllocation[i].EmployeeName != null)
                        {
                            scheduleDGV[k, j].Value = lstAllocation[i].EmployeeName;
                        }
                    }
                }
            }
        }

        //scheduleDGV.DataSource = lstEmployeeSlot;
    }
</code></pre>

<p>The error is displayed when it reaches this line, </p>

<pre><code>for (int i = 0; i &lt; lstAllocation.Count; i++)
</code></pre>

<p>Does anyone know what's wrong here? Is it possible that it is transferred into another computer? </p>
