L
learning_csharp
Can someone help me convert this to c#
----------------------------------------------------------------------------
-----------
Public Class ResetPassword
'Constants associated with check boxes
Private Const PASS_UPPERS As String = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
Private Const PASS_LOWERS As String = "abcdefghijklmnopqrstuvwxyz"
Private Const PASS_NUMBERS As String = "0123456789"
Private Const PASS_SPECIALS As String = "~`!@#$%^&*()_+=-{[}]|;:'<,>.?"
Public Function GeneratePassword(ByVal Uppers As Boolean, ByVal Lowers
As Boolean, ByVal Numbers As Boolean, ByVal Specials As Boolean, ByVal
passwordLength As Integer) As String
Dim strCharacters As String
Dim strNewPassword As String
Dim p As Integer
If Uppers = True Then
strCharacters = strCharacters & PASS_UPPERS
End If
If Lowers = True Then
strCharacters = strCharacters & PASS_LOWERS
End If
If Numbers = True Then
strCharacters = strCharacters & PASS_NUMBERS
End If
If Specials = True Then
strCharacters = strCharacters & PASS_SPECIALS
End If
Randomize()
For p = 0 To (passwordLength - 1)
strNewPassword = strNewPassword + Mid(strCharacters,
Len(strCharacters) * Rnd() + 1, 1)
Next
GeneratePassword = strNewPassword
End Function
End Class
----------------------------------------------------------------------------
-----------
Public Class ResetPassword
'Constants associated with check boxes
Private Const PASS_UPPERS As String = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
Private Const PASS_LOWERS As String = "abcdefghijklmnopqrstuvwxyz"
Private Const PASS_NUMBERS As String = "0123456789"
Private Const PASS_SPECIALS As String = "~`!@#$%^&*()_+=-{[}]|;:'<,>.?"
Public Function GeneratePassword(ByVal Uppers As Boolean, ByVal Lowers
As Boolean, ByVal Numbers As Boolean, ByVal Specials As Boolean, ByVal
passwordLength As Integer) As String
Dim strCharacters As String
Dim strNewPassword As String
Dim p As Integer
If Uppers = True Then
strCharacters = strCharacters & PASS_UPPERS
End If
If Lowers = True Then
strCharacters = strCharacters & PASS_LOWERS
End If
If Numbers = True Then
strCharacters = strCharacters & PASS_NUMBERS
End If
If Specials = True Then
strCharacters = strCharacters & PASS_SPECIALS
End If
Randomize()
For p = 0 To (passwordLength - 1)
strNewPassword = strNewPassword + Mid(strCharacters,
Len(strCharacters) * Rnd() + 1, 1)
Next
GeneratePassword = strNewPassword
End Function
End Class