private void btnDeposit_Click(object sender, EventArgs e) { // Creates a new dialog window DepositForm dlg = new DepositForm(customer, lstAccounts.SelectedIndex); dlg.ShowDialog(); // Closes the dialog window dlg.Dispose(); }