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

Recommended Answers

All 6 Replies

What you want to repeat, I think I cant able to understand what you want to say can you explain it

The application needs to accept 3 original passwords in the Inputbox and display them in a label on the interface, so right now the application only accepts one password and I'm not sure how to make it accept 3 and display them all.

Its look like very simple use three label and loop like

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Dim oldpassword(3) As String
        Dim ispasswordvalid As Boolean
        Dim revpassword(3) As String
        For i = 0 To 2


            oldpassword(i) = InputBox("Enter a 5-7 character password:", _
                                "New Password")


            If oldpassword(i).Length >= 5 And oldpassword(i).Length <= 7 Then
                ispasswordvalid = True
            End If

            If ispasswordvalid = True Then


                oldpassword(i) = oldpassword(i).Replace("a", "x")
                oldpassword(i) = oldpassword(i).Replace("e", "x")
                oldpassword(i) = oldpassword(i).Replace("i", "x")
                oldpassword(i) = oldpassword(i).Replace("o", "x")
                oldpassword(i) = oldpassword(i).Replace("u", "x")
                oldpassword(i) = oldpassword(i).Replace("1", "z")
                oldpassword(i) = oldpassword(i).Replace("2", "z")
                oldpassword(i) = oldpassword(i).Replace("3", "z")
                oldpassword(i) = oldpassword(i).Replace("4", "z")
                oldpassword(i) = oldpassword(i).Replace("5", "z")
                oldpassword(i) = oldpassword(i).Replace("6", "z")
                oldpassword(i) = oldpassword(i).Replace("7", "z")
                oldpassword(i) = oldpassword(i).Replace("8", "z")
                oldpassword(i) = oldpassword(i).Replace("9", "z")
                oldpassword(i) = oldpassword(i).Replace("0", "z")


            Else
                ispasswordvalid = False
                MessageBox.Show("5-7 characters required", _
                                "New Password", MessageBoxButtons.OK, _
                                MessageBoxIcon.Information)

            End If

            revpassword(i) = StrReverse(oldpassword(i))

        Next
        Label1.Text = revpassword(0)
        Label2.Text = revpassword(1)
        Label3.Text = revpassword(2)
    End Sub

I hope it will help you, is this you want

Its look like very simple use three label and loop like

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Dim oldpassword(3) As String
        Dim ispasswordvalid As Boolean
        Dim revpassword(3) As String
        For i = 0 To 2


            oldpassword(i) = InputBox("Enter a 5-7 character password:", _
                                "New Password")


            If oldpassword(i).Length >= 5 And oldpassword(i).Length <= 7 Then
                ispasswordvalid = True
            End If

            If ispasswordvalid = True Then


                oldpassword(i) = oldpassword(i).Replace("a", "x")
                oldpassword(i) = oldpassword(i).Replace("e", "x")
                oldpassword(i) = oldpassword(i).Replace("i", "x")
                oldpassword(i) = oldpassword(i).Replace("o", "x")
                oldpassword(i) = oldpassword(i).Replace("u", "x")
                oldpassword(i) = oldpassword(i).Replace("1", "z")
                oldpassword(i) = oldpassword(i).Replace("2", "z")
                oldpassword(i) = oldpassword(i).Replace("3", "z")
                oldpassword(i) = oldpassword(i).Replace("4", "z")
                oldpassword(i) = oldpassword(i).Replace("5", "z")
                oldpassword(i) = oldpassword(i).Replace("6", "z")
                oldpassword(i) = oldpassword(i).Replace("7", "z")
                oldpassword(i) = oldpassword(i).Replace("8", "z")
                oldpassword(i) = oldpassword(i).Replace("9", "z")
                oldpassword(i) = oldpassword(i).Replace("0", "z")


            Else
                ispasswordvalid = False
                MessageBox.Show("5-7 characters required", _
                                "New Password", MessageBoxButtons.OK, _
                                MessageBoxIcon.Information)

            End If

            revpassword(i) = StrReverse(oldpassword(i))

        Next
        Label1.Text = revpassword(0)
        Label2.Text = revpassword(1)
        Label3.Text = revpassword(2)
    End Sub

I hope it will help you, is this you want

Thanks that's exactly what I needed.

Then mark this thread as solve ok

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.