Save datagridview to List in another class
<p>I have a MainForm and there I have some button and a listview. I also have a subform called <code>DiaryForm</code> where I have a datagridview. The datagridview is connected to a separate class called <code>Movements</code>. In <code>Movements</code> I have some properties for the different columns. I have also a class called <code>DiaryManager</code> where I want to save the datagridview to a List.</p>

<p>In <code>DiaryForm</code> this is how I save the datagridview:</p>

<pre><code>    /// &lt;summary&gt;
    /// Save datagrid to list. Loop through every row.
    /// &lt;/summary&gt;
    public void SaveDatagrid()
    {

      //  List&lt;Movements&gt; myList = m_diaryMgr.MovementsList;

        for (int i = 0; i &lt; dataGridView1.Rows.Count; i++)
        {
            Movements content = new Movements();
            for (int j = 0; j &lt; dataGridView1.Columns.Count; j++)
            {
                // Has to make this check otherwise it crashes if one row is empty
                string strValue = dataGridView1[j, i].Value == null ? string.Empty : dataGridView1[j, i].Value.ToString();

                if (j == 0)
                    content.Exercise = strValue;
                else if (j == 1)
                    content.KgReps1 = strValue;
                else if (j == 2)
                    content.KgReps2 = strValue;
                else if (j == 3)
                    content.KgReps3 = strValue;
                else if (j == 4)
                    content.KgReps4 = strValue;
                else if (j == 5)
                    content.KgReps5 = strValue;
            }
            m_diaryMgr.AddSession(content);
        }
    }
</code></pre>

<p>The AddSession method just add the info from datagridview to the list like so:</p>

<pre><code>        /// &lt;summary&gt;
    /// Adds a training session
    /// &lt;/summary&gt;
    public bool AddSession(Movements movementsIn)
    {
        if (movementsIn != null)
        {
            m_moveList.Add(movementsIn);
            return true;
        }

        else
            return false;
    }
</code></pre>

<p>But when I try to access the information via a property in DiaryManager from Mainform using a test button with this method nothing shows:</p>

<pre><code>        private void button1_Click(object sender, EventArgs e)
    {
            if (diaryMnr.MovementsList.Count &gt; 0)
            {
                foreach (Movements movement in diaryMnr.MovementsList)
                {
                    MessageBox.Show(movement.KgReps1);
                } 
            }
            else
            {
                MessageBox.Show("No information in here..");
            }

    }
</code></pre>

<p>MovementList is the property and movement is the class and KgReps just a property/column.
MovementList property looks like this:</p>

<pre><code>        /// &lt;summary&gt;
    /// Property related to the list m_moveList
    /// Read and write access.
    /// &lt;/summary&gt;
    public List&lt;Movements&gt; MovementsList
    {
        get { return m_moveList; }

        set { m_moveList = value; }
    }
</code></pre>

<p>The strange thing here (for me) is that when I use a test button in my DiaryForm were the datagridview is it can show the information!! But not in MainForm with exactly the same code. When I close the DiaryForm and opens it then it loads the information perfect.
But I can't save the information to file because it just keep trying to save an empty list!?</p>

<p>I would be greatful for some tips..</p>
