TextEdit不能空验证设置

时间:2021-12-12 20:27:11

在工具箱中找到dxValidationProvider控件拖拉到界面上,添加代码

ConditionValidationRule notEmptyValidationRule = new ConditionValidationRule();
notEmptyValidationRule.ConditionOperator
= ConditionOperator.IsNotBlank;
notEmptyValidationRule.ErrorText
= "请输入 该表单不能为空!";
dxValidationProvider1.SetValidationRule(BulidName, notEmptyValidationRule);
//两个参数表示验name值为BulidName的TextEdit控件为notEmptyValidationRule验证