Example #1
0
 private void btnAddExpense_Click(object sender, EventArgs e)
 {
     if (expense == null || expense.IsDisposed)
     {
         expense = new AddExpense(0);
     }
     expense.Show();
     expense.BringToFront();
 }
 //double click on expense data cell
 private void dgvExpenses_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     //if not a header row
     if (e.RowIndex >= 0)
     {
         //display info
         int expenseNo = Convert.ToInt32((this.dgvExpenses.Rows[e.RowIndex].Cells["ExpenseNo"].Value).ToString());
         if (viewExpense == null || viewExpense.IsDisposed)
         {
             viewExpense = new AddExpense(expenseNo);
         }
         viewExpense.Show();
     }
 }