private void btnSaveAllo_Click(object sender, EventArgs e) { foreach (DataGridViewRow row in DGVAllocator.Rows) { if (DGVAllocator["tbcCommission", row.Index].Value == null && DGVAllocator["tbcQty", row.Index].Value != null) { DGVAllocator["tbcCommission", row.Index].Value = 0; } } if (!(_alloc == 0)) { label6.Text = "Error: You have allocated the wrong amount of trades"; label6.ForeColor = Color.Red; return; } if (DGVAllocator["tbcQty", DGVAllocator.Rows.Count - 1].Value == null) { DGVAllocator.Rows.RemoveAt(DGVAllocator.Rows.Count - 1); } string[] command = new string[DGVAllocator.Rows.Count - 1]; List <int> Quantity = new List <int>(); List <string> Account = new List <string>(); decimal Commission = Convert.ToDecimal(DGVAllocator["tbcCommission", 0].Value); foreach (DataGridViewRow row in DGVAllocator.Rows) { Quantity.Add(Convert.ToInt32(row.Cells["tbcQty"].Value)); Account.Add(row.Cells["tbcClientAcct"].Value.ToString()); } notifyDel?.Invoke(Quantity, Account, Commission); this.Close(); }