I am working on a change password windows form application in C# (visual studio). This is how my application will work, after the user have enter their new password and pass the textbox validation a tick will be shown beside the new password textbox.
The problem i am facing is how can i check that the retyped password is same as the new password that is being entered? After checking that they are the same, the tick will appear to show the user that it is checked and the same. I do not want to click any button to check both the textbox instead checking once the user have stop typing. How can i do that?
Create a new windows forms project. Put two textboxes on the form, nothing more. Use their default names of
textBox1andtextBox2Put the code below inForm1.cs(as this is the default name of the file). Now when ever a user has pressed a key, the comparement will be made. If the text is the same, the backcolor of the textboxes becomes green, otherwise it becomes red.Note that I did not use the designer to attach the KeyUp event, I did that in the constructor of Form1:
textBox1.KeyUp += textBox_Compare;