I have created a random password generator function in asp.net (vb.net). How do i call this function through my asp.net button???
:cry:
Function RandomPW(ByVal myLength)
'These constant are the minimum and maximum length for random
'length passwords. Adjust these values to your needs.
Const minLength = 6
Const maxLength = 20
Dim X, Y, strPW
If myLength = 0 Then
Randomize()
myLength = Int((maxLength * Rnd()) + minLength)
End If
For X = 1 To myLength
'Randomize the type of this character
Y = Int((3 * Rnd()) + 1) '(1) Numeric, (2) Uppercase, (3) Lowercase
Select Case Y
Case 1
'Numeric character
Randomize()
strPW = strPW & Chr(Int((9 * Rnd()) + 48))
Case 2
'Uppercase character
Randomize()
strPW = strPW & Chr(Int((25 * Rnd()) + 65))
Case 3
'Lowercase character
Randomize()
strPW = strPW & Chr(Int((25 * Rnd()) + 97))
End Select
Next
RandomPW = strPW
End Function