You are verifying username and password through keychange event . It's completely wrong . It checks the data entered chr by chr . You can paste your code in a button rather than textboxchange event .