We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

What is reason for the text value is different when the TextChanged event is handled and after the control lost the focus?

Platform: WinForms |
Control: MaskedEditBox

Mask settings

The reason for this difference is the existence of DataGroups for the MaskedEditBox with different DataGroupAlignments. The DataGroups alignments will only apply after the control has lost the focus. This results in the Text property returning a value based on the unaligned state of the control.

For example, if the Mask string is set to ##.### and the following properties are set: UsageMode: Numeric (this means that the decimal and number part of the mask will be split into 2 default groups) PaddingCharacter: 0 In this case, when the user types in the number 2 with the cursor at the beginning of the text and the TextChanged event is handled, the Text property will return the value: 20.000 However, when the control loses the focus and the group alignment is applied, the Text property returns the value 02.000 On account of these reasons, do not use the Text property value from within the TextChanged event if there are DataGroups defined and the PaddingCharacter property is set to a value that will influence the Text property.

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile