adding values of a cell to anothervalues in datagridview
<pre><code>int rowsCount = 0;
            //This checks to see that both textbox for items and subitems do not gain focus at the same time
            if (textBoxSubItems.Text != string.Empty)
                txtItems.Enabled = false;
            else txtItems.Enabled = true;
                if (comboBoxItems.SelectedItem != null)
                {

                    int idx = dataGridViewTimesheet.Rows.Add();
                    DataGridViewRow row = dataGridViewTimesheet.Rows[idx];
                    row.Cells["items"].Value = comboBoxItems.SelectedItem.ToString() + "-" + textBoxSubItems.Text;
                    row.Cells["fromTime"].Value = DateTime.Now.ToLongTimeString();
                    row.Cells["toTime"].Value = null;
                    row.Cells["duration"].Value = null;
                    row.Cells["subTotal"].Value = null;
                   // row.Cells["comments"].Value = "1";
                }
                else MessageBox.Show("Please select an item");

                int count = 1;
                foreach (DataGridViewRow row in dataGridViewTimesheet.Rows)
                {
                    if (count % 2 == 0)
                    {
                        string secondColumn = dataGridViewTimesheet.Rows[count - 1].Cells[1].ToString();
                        dataGridViewTimesheet.Rows[count].Cells[2].Value = secondColumn;
                    }
                    count++;
                }

        }
</code></pre>

<p>This code is yet to work fine.It's displaying an exception (argument out of range exception) and not adding to the previous column as suppose. What i want it to do is that when the rows are more than one(1) in the datagridview it should insert the value of the second column of the currentRow (the last row created) to the third column of the previous row. How do I handle this? Thanks. </p>
