Click here to Skip to main content
14,825,880 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I have a login form in my program but, i want to have another form that user can change his password. it has three texboxes and one button. at the first textbox user write the old password,at the second write new password and at the third write new password confirm. when he click on the button password would change and if he type wrong, shows some errors.
please help me :confused:
thanks alot
Posted
Updated 10-Jun-18 19:49pm

Here is sample code to do that

//Assumed you have saved your old password in database or someplace else(like a file or something) and it's retrieved and stored in var called OldPassword 


if(txtOldPassword.Text == OldPassword)
{
    if(txtNewPassword.Text == txtReEnterNewPassword.Text)
    {
         //Save the new password to database or where ever you want
    }
    else
    {
         //Show error mes saying new password does not match.clear the         text box and ask user to re-enter password.
    }
}
else
{
    //give the error mes saying the password provided is wrong and try again
}  
   
If you have created it using the normal process by adding a Login group from the toolbox, then look at MSDN[^] and scroll down to "Letting Users Change Their Password"
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900