im new in vb.net
i need to make a form like this

For Firstname and Lastname: When you click to random Button it will auto pick random Firstname from Firstname.txt and random Lastname from Lastname.txt

For Username: when you click to random Username Button it will auto generate Username
from firstname, lastname, string, number like this

Username = firstname+number+lastname+string

For Password:

Password = random string + random number

Sorry for my bad english. Please help

Edited 6 Years Ago by p3p3p3: n/a

Show us the code you have done so far plz.
Or you expecting us to write you the whole code?
show some effort plz!

hi GeekByChoiCe
im new in vb.net that why im looking for some similar code like this. can you help :)

ok here is a small sample code as Console Application. the names in the two txt files should be one per line, else you have to adjust the code.

Sub Main()
		Dim fNames() As String = IO.File.ReadAllLines("Firstname.txt")
		Dim lNames() As String = IO.File.ReadAllLines("Lastname.txt")

		Randomize(DateAndTime.Now.Ticks)	'shuffle randoms, else the randoms will be the same on each start of the app
		Dim fRandom As New Random

		Dim rFirst As String = fNames(fRandom.Next(0, fNames.Count))
		Dim rLast As String = lNames(fRandom.Next(0, lNames.Count))
		Dim rNumber As Integer = fRandom.Next(10, 99)
		Console.WriteLine("Random FirstName: {0}", rFirst)
		Console.WriteLine("Random LastName: {0}", rLast)
		Console.WriteLine("Created Username: {0}{1}{2}", rFirst, rLast, rNumber)

		Dim passArray As ArrayList = fillArray(True)
		Dim pass As String = ""
		For x As Integer = 1 To 12 'to lenght of the password
			pass = pass & passArray.Item(fRandom.Next(0, passArray.Count)).ToString

		Console.WriteLine("Generated password: {0}", pass)
    End Sub

	Private Function fillArray(ByVal withSpecialChars As Boolean) As ArrayList
		Dim passArray As New ArrayList

		For i As Integer = AscW("A") To AscW("Z") 'add capitals

		For i As Integer = AscW("a") To AscW("z")  'add lower case

		For i As Integer = 0 To 9		 'add numbers

		If withSpecialChars Then		 'create list of special chars
			For i As Integer = 33 To 126
				If i < 48 Then
				ElseIf i >= 58 AndAlso i <= 64 Then
				ElseIf i >= 91 AndAlso i <= 96 Then
				ElseIf i >= 123 AndAlso i <= 126 Then
				End If
		End If
		Return passArray
	End Function

Edited 6 Years Ago by GeekByChoiCe: n/a

This article has been dead for over six months. Start a new discussion instead.