private void button3_Click_1(object sender, EventArgs e) { //Edit Budget //Check if there is a selected index if (listView1.SelectedIndices.Count > 0) { if (listView1.SelectedIndices[0] >= 0) { NewBudget form = new NewBudget(Data.getSelectedBudget()); form.ShowDialog(); Update_Budgetview(); } } else if (listView2.SelectedIndices.Count > 0) { if (listView2.SelectedIndices[0] >= 0) { New_Capital form = new New_Capital(Data.getSelectedCapital()); form.ShowDialog(); Update_Capitalview(); } } else { MessageBox.Show("Please select an item to edit"); } Save.Saveall(); }
private void button5_Click(object sender, EventArgs e) { //Check if there's an active account if (MessageBox.Show("Add Expense?", "Add Expense", MessageBoxButtons.YesNo) == DialogResult.Yes) { NewBudget form = new NewBudget(); form.ShowDialog(); Update_Budgetview(); } else if (MessageBox.Show("Add Capital?", "Add Capital", MessageBoxButtons.YesNo) == DialogResult.Yes) { New_Capital form = new New_Capital(); form.ShowDialog(); Update_Capitalview(); } //display error if there's no active account else { MessageBox.Show("Please select an account"); } Save.Saveall(); }