Question

VB program How to write a code that reset your password I need password reset method...

VB program

How to write a code that reset your password

I need password reset method that gets your current password and gets the new password by two Textboxes and reset button that reset the password to new one.

use the Sub resetpass(....)

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer:

Please find the VB Code as well as the screenprint. The names of the three text boxes are:

Current Password - txtCurrentPassword

New Password - txtNewPassword

Confirm Password - txtConfirmPassword

The PasswordChar Property for all the above textboxes are kept as "*". So, please update accordingly.

Screenprint:

Code:

Public Class Form1
    'This is the current password of user. In an ideal scenario, this can be expected
    'to automatically initialize when a user logs in to the application
    Public strPassword As String = "ABCD"
    Private Sub btnResetPassword_Click(sender As Object, e As EventArgs) Handles btnResetPassword.Click
        If txtCurrentPassword.Text = "" Then    'Current Password cannot be blank
            MsgBox("Please enter the Current Password.", vbCritical)
            txtCurrentPassword.Focus()
            Exit Sub
        End If
        If txtNewPassword.Text = "" Then    'New Password cannot be blank
            MsgBox("Please enter the New Password.", vbCritical)
            txtNewPassword.Focus()
            Exit Sub
        End If
        If txtConfirmPassword.Text = "" Then    'Confirm Password cannot be blank
            MsgBox("Please enter the Confirm Password.", vbCritical)
            txtConfirmPassword.Focus()
            Exit Sub
        End If
        'Calling the Procedure to reset the password
        Call resetPass(txtCurrentPassword.Text, txtNewPassword.Text, txtConfirmPassword.Text)
    End Sub
    Private Sub resetPass(strCurrPwd As String, strNewPwd As String, strConfPwd As String)
        'Checking to see if the current password entered is matching with
        'the actual password of user which is stored in the global variable
        'strPassword
        If strCurrPwd <> strPassword Then
            MsgBox("Current Password is Incorrect. Please enter the correct Password.", vbCritical)
            txtCurrentPassword.Focus()
            Exit Sub
        End If
        'Check to see if the New Password is same as the existing password
        If strNewPwd = strPassword Then
            MsgBox("New Password cannot be the same as existing password. Please enter a different Password.", vbCritical)
            txtNewPassword.Focus()
            Exit Sub
        End If
        'Check to see if the New Password is matching with the Confirm Password
        If strNewPwd <> strConfPwd Then
            MsgBox("New Password and Confirm Password is not matching. Please check.", vbCritical)
            txtConfirmPassword.Focus()
            Exit Sub
        End If
        'If all above conditions are passed, then update the global Password
        'variable with the New Password
        strPassword = strNewPwd
        'Successfull Password Change Message
        MsgBox("Password changed successfully!!!")
    End Sub
End Class

Add a comment
Know the answer?
Add Answer to:
VB program How to write a code that reset your password I need password reset method...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • i need know how Write a program that tests whether a string is a valid password....

    i need know how Write a program that tests whether a string is a valid password. The password rules are: It must have at least eight characters. It must contain letters AND numbers It must contain at least two digits It must contain an underscore (_) Write a program that prompts the user to enter a password and displays the password entered and whether it is valid or invalid.

  • Write the Code in C program. Create a random password generator that contains a user-specified number...

    Write the Code in C program. Create a random password generator that contains a user-specified number of characters. Your program should prompt the user for the desired length of the password. Length of password: To create your password, use the random number generator in the stdlib.h C library. To generate random numbers, you will need the srand() and rand() functions. srand(seed) is used to "seed" the random number generator with the given integer, seed. Prompt the user for the seed...

  • Write a password cracker program for the passwords created according to the policy outlined in assignment...

    Write a password cracker program for the passwords created according to the policy outlined in assignment 15 (exactly 8 characters: 5 letters and 3 digits). You are to write a function that takes one parameter that is a hash of a password and should return a possible password (a string) that has the same hash. Use python secure hash function sha1 from hashlib module. Hint: brute force method will be more than adequate to the task.   Please I need it...

  • Please I need Visual Basic code with Excel sheet Develop a general VB code that can...

    Please I need Visual Basic code with Excel sheet Develop a general VB code that can compute the determinant of a 3 x 3 matrix (input the matrix values from cells in the spreadsheet) using the method we discussed in class. Have your program use cofactor expansion, expanding about the members in the second row (if you want to expand about some other row or column later for your own personal use, that’s fine, but for this program, expand about...

  • Write a sql program for password requirment: I just need sql query. Passwords are required for...

    Write a sql program for password requirment: I just need sql query. Passwords are required for all accounts: Passwords must have a minimum length of 10 characters; Passwords must have complexity (at least one numeric mixed with alphabetic characters. Upper case and special characters will be allowed but not forced); Passwords must be changed at least every 90 days; and, Passwords must be forced to be different than the previous 6 passwords. Intruder lockout settings are required for all accounts:...

  • Password Validation Write a program called PasswordValidationYourLastName that validates a new password, following these guidelines: Must...

    Password Validation Write a program called PasswordValidationYourLastName that validates a new password, following these guidelines: Must be at least 8 characters Must have at least 1 uppercase letter Must have at least 1 lowercase letter Must have at least 1 digit Write a program that asks for a password, and then asks again to confirm it (you can use the scanner or JOptionPane). Pass those two Strings to a method called validatePassword( ). Your validatePassword( ) should return a boolean...

  • Python 3.6 I need the code ready to run using GUI programming Write a program for...

    Python 3.6 I need the code ready to run using GUI programming Write a program for the Knight's Tour problem. Your program should let the user move a knight to any starting square and click the Solve button to animate a knight moving along the path, as shown below.

  • I need help with this code: Write a program that calculates the future value of an...

    I need help with this code: Write a program that calculates the future value of an investment at a given interest rate for a specified number of years. The formula for the calculation is as follows: futureValue = investmentAmount * (1 + monthlyInterestRate)years*12 Use text fields for interest rate, investment amount, and years. Display the future amount in a text field when the user clicks the Calculate button, as shown in the following figure. It needs to be done in...

  • Need help!!! I need two programs that use one common database.. One program using a Visual...

    Need help!!! I need two programs that use one common database.. One program using a Visual Basic windows form using textboxes for data input (first name, last name, phone, email) and it should save the info into an SQL database when a save button is clicked. Second program using a C# windows form that has a drop down menu with all the names that have been saved into the database, when one name is clicked all their information should pop...

  • In Java, please write the program for the following program. Please TEST YOUR PROGRAM. You MUST...

    In Java, please write the program for the following program. Please TEST YOUR PROGRAM. You MUST use GUI, that means all user input must be through the windows. The "first window" is the window on the top left of the following picture. Add 5 more items to be purchased. Search is accessed from second window, top right. Thw third window is the bottom left, and the fourth window is the bottom right. The program MUST CONTAIN EVERYTHING IN THE PICTURES....

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT