private void RowValidatedRatings(object sender, DataGridViewCellEventArgs e) { if (currentRatingAgency == null) { return; } TableUtility tableUtility = new TableUtility(Globals.WatchdogAddIn.Application.ActiveWorkbook); tableUtility.CreateMissingTable(Rating.GetDefaultValue()); Rating newRating = dataGridViewRatingCodes.Rows[e.RowIndex].DataBoundItem as Rating; if (newRating == null) { return; } if (newRating.Index == 0) { tableUtility.InsertTableRow(newRating, new List<string> { newRating.RatingCode, newRating.RatingNumericValue.ToString(), currentRatingAgency.Index.ToString() }); return; } if (!currentRow.RatingCode.Equals(newRating.RatingCode)) { TableUpdateWrapper update = new TableUpdateWrapper(currentRow.Index, "rating_code", newRating.RatingCode); tableUtility.UpdateTableRow(currentRow, update); } if (currentRow.RatingNumericValue != newRating.RatingNumericValue) { TableUpdateWrapper update = new TableUpdateWrapper(currentRow.Index, "numeric_value", newRating.RatingNumericValue.ToString()); tableUtility.UpdateTableRow(currentRow, update); } }