private void btn_new_Click(object sender, EventArgs e) { string invoiceAmount = tb_invoiceAmount.Text.Remove(0, 1); if (tickBox_editMode.Checked == false) { // New Invoice if (tb_invoiceAmount.Text == "" || tb_InvoiceDescription.Text == "") { MessageBox.Show("Invoice Amount or Description can not be empty"); return; } //normal save mode ( more error checking required - also option on button save yes / no string message = "You are about to add a new Invoice for: " + lb_clientID.Text; string caption = "InvoiceTable"; MessageBoxButtons buttons = MessageBoxButtons.YesNo; DialogResult result = MessageBox.Show(message, caption, buttons); string receivedDate = GetRecievedDate(); string paidDate = GetPaidDate(); if (result == DialogResult.Yes) { sql.InsertNewInvoiceData(FM_LoginScreen.conString, "InvoiceTable", cb_clientName.Text, invoiceAmount, tb_InvoiceDescription.Text, DateTime.Today.ToShortDateString(), tickbox_Receied.Checked, receivedDate, tickbox_paid.Checked, paidDate); } } else { // Edit Invoice if (tb_invoiceAmount.Text == "" || tb_InvoiceDescription.Text == "") { MessageBox.Show("Invoice Amount or Description can not be empty"); return; } //normal save mode ( more error checking required - also option on button save yes / no string message = "You are about to Change Invoice: " + lb_invoiceID.Text + " for: " + lb_clientID.Text; string caption = "InvoiceTable"; MessageBoxButtons buttons = MessageBoxButtons.YesNo; DialogResult result = MessageBox.Show(message, caption, buttons); string receivedDate = GetRecievedDate(); string paidDate = GetPaidDate(); if (result == DialogResult.Yes) { sql.UpdateChangesInvoiceTable(FM_LoginScreen.conString, "InvoiceTable", Convert.ToInt32(lb_invoiceID.Text) , cb_clientName.Text, invoiceAmount, tb_InvoiceDescription.Text , DateTime.Today.ToShortDateString(), tickbox_Receied.Checked , receivedDate, tickbox_paid.Checked, paidDate); } } // Set_Data_Table(); tickBox_editMode.Checked = false; Set_form_state(); // ADD a method to update LaidPaid in client Table ( this is only place the LaidPaid will need updating ) }