private void txtFishnetCellSize_Validating(object sender, CancelEventArgs e)
{
//check to see if it parses nicely
string errorMessage = string.Empty;
string cellSize = txtFishnetCellSize.Text.Trim();
if (!string.IsNullOrEmpty(cellSize))
{
var chunks = cellSize.Split("x_:, ".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
//1 param, square
if ((chunks.Length == 1)
&& ((Utilities.GetAs<double>(chunks[0], -1)) == -1))
{
errorMessage = "Invalid size";
}
//2 params, rectangle
else if ((chunks.Length == 2)
&& (((Utilities.GetAs<double>(chunks[0], -1)) == -1)
|| ((Utilities.GetAs<double>(chunks[1], -1)) == -1)))
{
errorMessage = "Invalid width/height";
}
}
this.errorProvider1.SetError(txtFishnetCellSize, errorMessage);
}