Hey everyone,
I'm currently working on an application with the following guidelines and need some help with completing it:
Create an application that allows the user to enter a password that contains five, six, or seven characters. The application should create and display a new password using the following three rules:
1) Replace all vowels (A,E,I,O,U) with the letter X.
2) Replace all numbers with the letter Z.
3) Reverse the characters in the password.
Also included in the guidelines:
1. Instead of using the textbox to accept user input, please enable users to enter the original password in an Inputbox.
2. Users should be able to enter 3 original passwords.
3. Display all three new passwords in a label, one in each line.
So far I have managed to get the application to create a password but I'm not sure how to make it repeat 3 times using the Inputbox and then display them in a label. Any assistance or suggestions would be greatly appreciated. Here's the code that I have so far:
Public Class MainForm
Private Sub exitButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles exitButton.Click
Me.Close()
End Sub
Private Sub displayButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles displayButton.Click
Dim oldpassword As String
Dim ispasswordvalid As Boolean
oldpassword = InputBox("Enter a 5-7 character password:", _
"New Password")
If oldpassword.Length >= 5 And oldpassword.Length <= 7 Then
ispasswordvalid = True
End If
If ispasswordvalid = True Then
oldpassword = oldpassword.Replace("a", "x")
oldpassword = oldpassword.Replace("e", "x")
oldpassword = oldpassword.Replace("i", "x")
oldpassword = oldpassword.Replace("o", "x")
oldpassword = oldpassword.Replace("u", "x")
oldpassword = oldpassword.Replace("1", "z")
oldpassword = oldpassword.Replace("2", "z")
oldpassword = oldpassword.Replace("3", "z")
oldpassword = oldpassword.Replace("4", "z")
oldpassword = oldpassword.Replace("5", "z")
oldpassword = oldpassword.Replace("6", "z")
oldpassword = oldpassword.Replace("7", "z")
oldpassword = oldpassword.Replace("8", "z")
oldpassword = oldpassword.Replace("9", "z")
oldpassword = oldpassword.Replace("0", "z")
Else
ispasswordvalid = False
MessageBox.Show("5-7 characters required", _
"New Password", MessageBoxButtons.OK, _
MessageBoxIcon.Information)
End If
Dim revpassword As String
revpassword = StrReverse(oldpassword)
newpasswordLabel.Text = revpassword
End Sub
End Class