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...

  • 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...

  • 1. Write a C++ program called Password that handles encrypting a password. 2. The program must...

    1. Write a C++ program called Password that handles encrypting a password. 2. The program must perform encryption as follows: a. main method i. Ask the user for a password. ii. Sends the password to a boolean function called isValidPassword to check validity. 1. Returns true if password is at least 8 characters long 2. Returns false if it is not at least 8 characters long iii. If isValidPassword functions returns false 1. Print the following error message “The password...

  • 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....

  • Hello I just need the code for this GUI thanks Also computer screenshot of the code...

    Hello I just need the code for this GUI thanks Also computer screenshot of the code will be helpful Attached is an incomplete Python template file. button_multi_colour_changer_Q.py Download this file and complete it to solve the following problem. Consider the GUI below (4 Labels, 4 colour Buttons and a "RESET" Button) which has been produced with a Python program using the Tkinter library. MULTI Button Colour - a X MULTI Button Colour - O X Violet Purple Blue | Green...

  • I need to write a vb program for a poker game that uses a two-dimensional array......

    I need to write a vb program for a poker game that uses a two-dimensional array... Here is the problem: A poker hand can be stored in a two-dimensional array. The statement Dim hand(3, 12) As Integer declares an array with 52 elements, where the first subscript ranges over the four suits and the second subscript ranges over the thirteen denominations. A poker hand is specified by placing 1%u2019s in the elements corresponding to the cards in the hand. Write...

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
ADVERTISEMENT