Jump to content

Gerador passwords em v6


a3deluxe
 Share

Recommended Posts

Boas

criei um gera de passwords

com 3 letras e 5 números

mas gera tudo baralhado, para isso criei txtbox individuais.

Eu queria que ele gera-se tudo junto mas primeiro as letras depois os números.

aqui fica o código:

Private Sub Command1_Click()

Text1 = GenerateCode()

End Sub

Public Function GenerateCode()

strInputString = "012356789"

intLength = Len(strInputString)

intNameLength = 5 '

Randomize

strName = ""

For intStep = 1 To intNameLength

intRnd = Int((intLength * Rnd) + 1)

strName = strName & Mid(strInputString, intRnd, 1)

Next

GenerateCode = strName

End Function

Public Function GenerateCode2()

strInputString = "abcdefghijklmnqsuvwxyz"

intLength = Len(strInputString)

intNameLength = 3 '

Randomize

strName = ""

For intStep = 1 To intNameLength

intRnd = Int((intLength * Rnd) + 1)

strName = strName & Mid(strInputString, intRnd, 1)

Next

GenerateCode2 = strName

End Function

Private Sub Command2_Click()

End

End Sub

Private Sub Form_Load()

End Sub

HELP

Link to comment
Share on other sites

Faz mais simples : primeiro as letras

Private Sub Command1_Click()

strN = "0123456789"

strA = "abcdefghijklmnopqrstuvxyz"

strPW = ""

For i = 1 To 3

    Randomize

    intRnd = Int((Len(strA) * Rnd) + 1)

    strPW = strPW & Mid(strA, intRnd, 1)

Next i

For i = 1 To 5

    Randomize

    intRnd = Int((Len(strN) * Rnd) + 1)

    strPW = strPW & Mid(strN, intRnd, 1)

Next i

Label1.Caption = strPW

End Sub

Link to comment
Share on other sites

JRS problema resolvido.

strN = "0123456789"

strA = "abcdefghijklmnopqrstuvxyz"

strPW = ""

For i = 1 To 3

    Randomize

    intRnd = Int((Len(strA) * Rnd) + 1)

    strPW = strPW & Mid(strA, intRnd, 1)

Next i

For i = 1 To 5

    Randomize

    intRnd = Int((Len(strN) * Rnd) + 1)

    strPW = strPW & Mid(strN, intRnd, 1)

Next i

Text1 = strPW

End Sub

muito obrigado.

Link to comment
Share on other sites

Faça um loop (For tx=1 to nx) externo e replique o Text1 (ctrl c, ctrl v na form) e quando pedir se quer com o mesmo nome (Text1) e indexado clique ok, ou seja, Text1(0), Text1(1), Text1(2)..........quantos forem necessarios, ou seja, nx e considere o 0 ---> Text1(nx-1)......

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.