In the OnTextChanged event, the Text property remains the old one and has not been changed. The new string is passed as the text argument to OnTextChanged. You can check the text in OnTextChanged and change the entered text by rewriting the text if necessary.