Message 需要您在事件中弹出来。
- gcSpreadSheet1.HighlightInvalidData = true;
- gcSpreadSheet1.ValidationError += GcSpreadSheet1_ValidationError;
- var valid1 = DataValidator.CreateNumberValidator(ComparisonOperator.Between, -999999999999, 999999999999, false);
- valid1.ErrorStyle = ErrorStyle.Stop;
- valid1.ErrorMessage = "请输入数字";
- gcSpreadSheet1.Sheets[0].Cells[1, 1].DataValidator = valid1;
- gcSpreadSheet1.Sheets[0].Cells[1, 0].Text = "A number";
-
- private void GcSpreadSheet1_ValidationError(object sender, GrapeCity.Windows.SpreadSheet.UI.ValidationErrorEventArgs e)
- {
- if (e.Validator.ErrorStyle == ErrorStyle.Stop)
- {
- e.ValidationResult = DataValidationResult.Retry;
- MessageBox.Show(e.Validator.ErrorMessage);
- }
- }
复制代码 |