private void butOK_Click(object sender, System.EventArgs e) { if (textDate.errorProvider1.GetError(textDate) != "" ) { MessageBox.Show(Lan.g(this, "Please fix data entry errors first.")); return; } if (tb2.SelectedIndices.Length == 0) { MessageBox.Show(Lan.g(this, "At least one item must be selected, or use the delete button.")); return; } if (comboClinic.SelectedIndex == 0) { ClaimPaymentCur.ClinicNum = 0; } else { ClaimPaymentCur.ClinicNum = Clinics.List[comboClinic.SelectedIndex - 1].ClinicNum; } ClaimPaymentCur.CheckAmt = PIn.PDouble(textAmount.Text); ClaimPaymentCur.CheckDate = PIn.PDate(textDate.Text); ClaimPaymentCur.CheckNum = textCheckNum.Text; ClaimPaymentCur.BankBranch = textBankBranch.Text; ClaimPaymentCur.CarrierName = textCarrierName.Text; ClaimPaymentCur.Note = textNote.Text; try{ ClaimPayments.Update(ClaimPaymentCur); //error thrown if trying to change amount and already attached to a deposit. } catch (ApplicationException ex) { MessageBox.Show(ex.Message); return; } //this could be optimized to only save changes. //Would require a starting AL to compare to. //But this isn't bad, since changes all saved at the very end ArrayList ALselected = new ArrayList(); for (int i = 0; i < tb2.SelectedIndices.Length; i++) { ALselected.Add(tb2.SelectedIndices[i]); } for (int i = 0; i < splits.Length; i++) { if (ALselected.Contains(i)) //row is selected { ClaimProcs.SetForClaim(splits[i].ClaimNum, ClaimPaymentCur.ClaimPaymentNum, ClaimPaymentCur.CheckDate, true); } else //row not selected { ClaimProcs.SetForClaim(splits[i].ClaimNum, ClaimPaymentCur.ClaimPaymentNum, ClaimPaymentCur.CheckDate, false); } } DialogResult = DialogResult.OK; }