コード例 #1
0
ファイル: frmMain.cs プロジェクト: JacobEnos/Budgeting-Calc
        private void btnManageExpense_Click(object sender, EventArgs e)
        {
            int index = lstExpenses.SelectedIndex;

            if (index != -1)
            {
                frmNewExpense modify = new frmNewExpense(Expenses[index], Expenses);
                modify.ShowDialog();

                if (modify.Tag.GetType().Name == "Expense")
                {
                    Expenses[index] = (Expense)modify.Tag;
                    RefreshExpenses();
                }
                else if ((int)modify.Tag == -1)
                {
                    //MessageBox.Show("Expense was canceled");
                }
                else
                {
                    //MessageBox.Show("No expense returned by frmNewExpense");
                }

                RefreshExpenses();
            }
            else
            {
                MessageBox.Show("No Expense selected.");
            }

            btnCalc_Click(sender, e);
        }
コード例 #2
0
ファイル: frmMain.cs プロジェクト: JacobEnos/Budgeting-Calc
        private void btnAddExpense_Click(object sender, EventArgs e)
        {
            frmNewExpense newExpense = new frmNewExpense(Expenses);

            newExpense.ShowDialog();
            if (newExpense.Tag == null)
            {
                //MessageBox.Show("No expense returned by frmNewExpense");
            }
            else if (newExpense.Tag.GetType().Name == "Expense")
            {
                Expenses.Add((Expense)newExpense.Tag);
            }
            else if ((int)newExpense.Tag == -1)
            {
                //MessageBox.Show("Expense was canceled");
            }
            else
            {
                //MessageBox.Show("Unknown response returned by frmNewExpense");
            }

            RefreshExpenses();
            btnCalc_Click(sender, e);
        }