The easiest way if to move the code from your TextChanged event to the
Leave[
^] event - as the user has finished input by then.
Alternatively, store it only when the login is successful - that way "amhedsalah" doesn't get stored either because the username isn't found in the login DB.