private void NewRowManual(ref PDataLabelLookupCategoryRow ARow) { // Deal with the primary key - we need a unique Category code string newName = Catalog.GetString("NEWCODE"); Int32 countNewDetail = 0; if (FMainDS.PDataLabelLookupCategory.Rows.Find(new object[] { newName }) != null) { while (FMainDS.PDataLabelLookupCategory.Rows.Find(new object[] { newName + countNewDetail.ToString() }) != null) { countNewDetail++; } newName += countNewDetail.ToString(); } ARow.CategoryCode = newName; }