Articles in this section
Category / Section

How do the MinValue and MaxValue properties influence the behavior of the CurrencyTextBox?

2 mins read

 

The CurrencyTextBox takes the approach that considers two aspects of the contents of the text box to enforce the MinValue and MaxValue properties. The two aspects are: 1. The numerical value of the contents of the text box: This can be defined as the DecimalValue that the contents represent. For example, if the content of the CurrencyTextBox displays $1,234.34 and the MinValue is set to 1000.00 and the MaxValue is set to 2000.00, the NumericalValue of the CurrencyTextBox is 1234.34 and the text is considered valid based on the Minimum/Maximum considerations. 2. The length of the Numerical Part of the contents of the text box.

This can be defined easily through an example. If the content of the CurrencyTextBox displays $123.00 and the MinValue is set to 1000.00 and the MaxValue is set to 2000.00, the Numerical Part length of the CurrencyTextBox is 3 (considering only the 123 part of the CurrencyTextBox content). The Number Part Length of the MinValue is 4 (considering 1000) and the Number Part Value of the MaxValue is 4 (considering 2000). In this case, the NumericalValue comparison (aspect 1 explained above) is not applied when the user is inputting text. Shown below is the definition of when the above aspects are applied:

ActionAspects considered for MinValue and MaxValueCommentsUser inputs valueIn the following cases, only the length aspect is considered.

2.00 (allowed as length is less than 4)

22.00 (allowed as length is less than 4)

223.00 (allowed as length is less than 4)

In these cases, both the aspects are considered

2231.00 (not allowed as length equals 4 and value is greater than MaxValue)

1234.45 (allowed as length equals 4 and value is between Min and Max )

 

The example considers MinValue of 1000.00 and MaxValue of 2000.00User pastes into CurrencyTextBoxThe length aspect is not considered.

999.00 (not allowed as value is lesser than MinValue)

1999.00 (allowed as value is is between Min and Max)

The example considers MinValue of 1000.00 and MaxValue of 2000.00Text property is set through codeThe length aspect is not considered.

999.00 (not allowed as value is lesser than MinValue)

1999.00 (allowed as value is is between Min and Max)

 

The example considers MinValue of 1000.00 and MaxValue of 2000.00NOTE: When the value is not allowed in the above cases, a ValidationError event is raised. Also, during the Validating event, the ValidationError event is raised when the contents of the CurencyTextBox does not meet the MinValue and MaxValue conditions.

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied