Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Class GeneratePassword
Shared Function Main() As Integer
Dim passwordlength As String
Dim s As String = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789?!"
Dim r As Random
Dim i As Integer
Console.WriteLine("-- Passwort-Generator --")
Console.WriteLine("Choose the Password length")
passwordlength = Console.ReadLine()
Dim passwordChars() As Char = New Char(passwordLength - 1) {}
Dim charIndex As Integer
For i As Integer = 0 To passwordLength - 1
charIndex = r.Next(s.Length)
passwordChars(i) = s(charIndex)
Next
Dim password As New String(passwordChars)
End Function
End Class
Advertisements
We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.
AcceptLearn more