private void butOK_Click(object sender, System.EventArgs e) { if (textDate.errorProvider1.GetError(textDate) != "") { MsgBox.Show(this, "Please fix data entry errors first."); return; } if (SplitList.Count == 0) { MsgBox.Show(this, "Please enter transfers first."); return; } double total = 0; for (int i = 0; i < SplitList.Count; i++) { total += SplitList[i].SplitAmt; } if (total != 0) { MsgBox.Show(this, "Total must equal zero."); return; } PaymentCur.PayNote = textNote.Text; PaymentCur.PayDate = PIn.PDate(textDate.Text); PaymentCur.IsSplit = true; try { Payments.Update(PaymentCur); } catch (ApplicationException ex) { //this catches bad dates. MessageBox.Show(ex.Message); return; } //Set all DatePays the same. for (int i = 0; i < SplitList.Count; i++) { SplitList[i].DatePay = PaymentCur.PayDate; SplitList[i].ProcDate = PaymentCur.PayDate; } PaySplits.UpdateList(SplitListOld, SplitList); if (IsNew) { SecurityLogs.MakeLogEntry(Permissions.PaymentCreate, 0, Lan.g(this, "Prov income transfer.")); } else { SecurityLogs.MakeLogEntry(Permissions.PaymentEdit, 0, Lan.g(this, "Prov income transfer.")); } DialogResult = DialogResult.OK; }