Please support our ASP.NET advertiser: Lunarpages ASP Web Hosting
•
•
Join Date: Jun 2005
Posts: 50
Reputation:
Rep Power: 4
Solved Threads: 0
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
: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
Similar Threads
Other Threads in the ASP.NET Forum
- Warning: Unknown(): Unable to call () - function does not exist in Unknown on line 0 (PHP)
- how to call a function in href? (ASP.NET)
- call a function (C)
- how to call this function...using menu..! (C++)
- Using a for loop to sum an integer n and call function add_it (C)
Other Threads in the ASP.NET Forum
- Previous Thread: Listbox Items as an array
- Next Thread: how to loop thru checked checkbox to retrieve its value?!?
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)






Threaded Mode