private void addInvoiceNr_btn_Click(object sender, EventArgs e) { if (selectedRowNumber != -1) { AddInvoiceForm invoiceForm = new AddInvoiceForm(datenSatz[selectedRowNumber]); DialogResult dialogresult = invoiceForm.ShowDialog(); if (dialogresult == DialogResult.OK) { Console.WriteLine(invoiceForm.invoiceNr); Transaction addTrans = new Transaction(datenSatz[selectedRowNumber].customerName, datenSatz[selectedRowNumber].sum.ToString()); addTrans.invoiceNumber = invoiceForm.invoiceNr; datenSatz[selectedRowNumber].invoiceList.Add(addTrans); datenSatz[selectedRowNumber].invoiceNumber = addTrans.invoiceNumber; datenSatz[selectedRowNumber].invoiceIndex = datenSatz[selectedRowNumber].invoiceList.Count - 1; refreshTable(); } else if (dialogresult == DialogResult.Cancel) { Console.WriteLine("You clicked either Cancel or X button in the top right corner"); } invoiceForm.Dispose(); } }
private void button17_Click(object sender, EventArgs e) { Form addInvoiceForm = new AddInvoiceForm(); addInvoiceForm.ShowDialog(); }