2014-03-28 57 views
0

我使用的DevExpress 13.1和我想創建一個自定義的驗證提供了一個文本框創建自定義的驗證供應商的DevExpress

我嘗試用這個代碼

DevExpress.XtraEditors.DXErrorProvider.ConditionValidationRule containsValidationRule = new DevExpress.XtraEditors.DXErrorProvider.ConditionValidationRule(); 
containsValidationRule.ConditionOperator = DevExpress.XtraEditors.DXErrorProvider.ConditionOperator.GreaterOrEqual; 
containsValidationRule.Value1 = '0'; 
containsValidationRule.ErrorText = "Veuillez saisir un valeur supérieur a zéro"; 
containsValidationRule.ErrorType = ErrorType.Warning; 

CompareAgainstControlValidationRule compValidationRule = new CompareAgainstControlValidationRule(); 
compValidationRule.Control = txtStockMax; 
compValidationRule.CompareControlOperator = CompareControlOperator.LessOrEqual; 
compValidationRule.ErrorText = "Veuillez saisir un valeur inférieur au stock max"; 
compValidationRule.CaseSensitive = true; 

dxValidationProvider1.SetValidationRule(txtStockMin, containsValidationRule); 
dxValidationProvider1.SetValidationRule(txtStockMin, compValidationRule); 

我要找的是該txtStockMingreaterOrEqual比0和txtStockMinlessOrEqualtxtStockMax

回答

0

請檢查DXValidationProvider幫助話題。本主題還包含一個清晰的代碼示例,介紹如何創建任何自定義驗證規則。