private void calculate_Click(object sender, EventArgs e) { frmDebt d = new frmDebt(); d.ShowDialog(); if (d.Value == DialogResult.OK) { Debt debt = new Debt(d.DebtName, d.Balance, d.IntrestRate, d.Payment, d.FirstPaymentDate); debtList.Debts.Add(debt); DebtList.Save(debtList, path); RefreshData(); } /* * double rate = Convert.ToDouble(txtRate.Text); * double payment = Convert.ToDouble(txtPayment.Text); * double balance = Convert.ToDouble(txtBalance.Text); * string name = txtName.Text; * if (name.Trim() == "") * { * name = "Debt " + (debtList.Debts.Count + 1).ToString(); * } * * Debt debt = new Debt(name, balance, rate, payment); * debtList.Debts.Add(debt); * * DebtList.Save(debtList, path); * * RefreshData(); */ }
private void gvDebts_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { frmDebt d = new frmDebt(debtList.Debts[e.RowIndex]); d.ShowDialog(); if (d.Value == DialogResult.OK) { Debt debt = new Debt(d.DebtName, d.Balance, d.IntrestRate, d.Payment, d.FirstPaymentDate); debtList.Debts[e.RowIndex] = debt; DebtList.Save(debtList, path); RefreshData(); } }