private void dgvExtraPayments_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { frmExtraPayment f = new frmExtraPayment(debtList.ExtraPayments[e.RowIndex]); f.ShowDialog(); if (f.Value == DialogResult.OK) { ExtraPayment ep = new ExtraPayment(); ep.Name = f.ExtraPaymentName; ep.Amount = f.Amount; ep.Recurring = f.Recurring; ep.StartDate = f.StartDate; ep.StopDate = f.StopDate; ep.IndefiniteStopDate = f.IndefiniteStopDate; debtList.ExtraPayments[e.RowIndex] = ep; DebtList.Save(debtList, path); RefreshData(); } }
private void button1_Click(object sender, EventArgs e) { frmExtraPayment f = new frmExtraPayment(); f.ShowDialog(); if (f.Value == DialogResult.OK) { ExtraPayment ep = new ExtraPayment(); ep.Name = f.ExtraPaymentName; ep.Amount = f.Amount; ep.Recurring = f.Recurring; ep.StartDate = f.StartDate; ep.StopDate = f.StopDate; ep.IndefiniteStopDate = f.IndefiniteStopDate; debtList.ExtraPayments.Add(ep); DebtList.Save(debtList, path); RefreshData(); } }