The latest version seems to be 3.2
The errorstr property is set for the numericupdown control. The set string will not take effect regardless of whether it is with HC namespace or not. After looking at the source code, modify a sentence in numericupdown.cs as follows:
Official source code
public virtual bool VerifyData() { OperationResult<bool> result; if (VerifyFunc != null) { result = VerifyFunc.Invoke(_textBox.Text); } else { if (!string.IsNullOrEmpty(_textBox.Text)) { if (double.TryParse(_textBox.Text, out var value)) { if (value < Minimum || value > Maximum) { result = OperationResult.Failed(Properties.Langs.Lang.OutOfRange); } else { result = OperationResult.Success(); } } else { result = OperationResult.Failed(Properties.Langs.Lang.FormatError); } } else if (InfoElement.GetNecessary(this)) { result = OperationResult.Failed(Properties.Langs.Lang.IsNecessary); } else { result = OperationResult.Success(); } } SetCurrentValue(ErrorStrProperty, result.Message); SetCurrentValue(IsErrorProperty, ValueBoxes.BooleanBox(!result.Data)); return result.Data; }
After modification
public virtual bool VerifyData() { OperationResult<bool> result; if (VerifyFunc != null) { result = VerifyFunc.Invoke(_textBox.Text); } else { if (!string.IsNullOrEmpty(_textBox.Text)) { if (double.TryParse(_textBox.Text, out var value)) { if (value < Minimum || value > Maximum) { result = OperationResult.Failed($"范围{Minimum}-{Maximum}"); } else { result = OperationResult.Success(); } } else { result = OperationResult.Failed(Properties.Langs.Lang.FormatError); } } else if (InfoElement.GetNecessary(this)) { result = OperationResult.Failed(Properties.Langs.Lang.IsNecessary); } else { result = OperationResult.Success(); } } SetCurrentValue(ErrorStrProperty, result.Message); SetCurrentValue(IsErrorProperty, ValueBoxes.BooleanBox(!result.Data)); return result.Data; }
Similar Posts:
- WPF TextBox Placeholder
- [Solved] mapper.xml Error: java.lang.AbstractMethodError: Method oracle/jdbc/driver/OracleResultSetImpl.getNString(Ljava/lang/String;)Ljava/lang/String; is abstract,
- Android Exception: UncaughtException detected: java.lang.RuntimeException: Parcelable encountered IOExcepti
- [Solved] Java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Double
- [Solved] warning MSB8004: Output Directory does not end with a trailing slash. This build instance will add the slash as it is required to allow proper evaluation of the Output Directory.
- ES Error:”illegal_argument_exception” [How to Solve]
- [LeetCode] 291. Word Pattern II
- Python OpenCV Save Image error: (-215:Assertion failed) !_img.empty()
- Spark2.x Error: Queue’s AM resource limit exceeded.