private void txtThuis_Validating(object sender, System.ComponentModel.CancelEventArgs e) { try { TextBox box = (TextBox)sender; int wedstrijdNbr = int.Parse(txtWedstrijdNummer.Text); int puntenThuis = Utils.IsNumeric(box.Text) ? int.Parse(box.Text) : -1; if (puntenThuis == -1) { box.Text = string.Empty; } else { if (puntenThuis > da.schema.SetsperWed) { box.Text = da.schema.SetsperWed.ToString(); puntenThuis = da.schema.SetsperWed; } txtUit.Text = ((int)(da.schema.SetsperWed - puntenThuis)).ToString(); } int puntenUit = Utils.IsNumeric(txtUit.Text) ? int.Parse(txtUit.Text) : -1; int nbr = wedstrijdNbr - da.poule.EersteWednbr; if (puntenThuis == -1) { txtThuis.Text = string.Empty; } if (puntenUit == -1) { txtUit.Text = string.Empty; } DataRow drRecord = da.dsDataSet1.tblUitslag.FindByTeamNaamWedNbr(da.poule.TeamNaam, nbr); if (drRecord == null) { drRecord = da.CreateNewUitslagRecord(da.poule.TeamNaam, nbr); } drRecord["Thuis"] = puntenThuis; drRecord["Uit"] = puntenUit; da.daUitslag.Update(da.dsDataSet1, "tblUitslag"); } catch (Exception ex) { Utils.ShowMessage(ex); } }