This is my 1st C# VS proj and I'm having some difficulty validating data entered on a column.
HEre's the code.
if (dgExtents.Columns[e.ColumnIndex].Name == "Sequence") //number is currently < 300
{
dgExtents.Rows[e.RowIndex].ErrorText =
""; int newInteger; if (dgExtents.Rows[e.RowIndex].IsNewRow) { return; } if (!int.TryParse(e.FormattedValue.ToString(), out newInteger) || newInteger < 0){
e.Cancel =
true;dgExtents.Rows[e.RowIndex].ErrorText =
"the Sequence value must be a number";}
if (string.IsNullOrEmpty(e.FormattedValue.ToString())){
dgExtents.Rows[e.RowIndex].ErrorText =
"Sequence is a required field";e.Cancel =
true;}