Private Function CreateRandomPassword(ByVal intPasswordLength As Integer) As String Try Dim strErlaubtChar As String = "abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNOPQRSTUVWXYZ0123456789!,." Dim chars As Char() = New Char(intPasswordLength - 1) {} Dim rd As New Random() For i As Integer = 0 To intPasswordLength - 1 chars(i) = strErlaubtChar(rd.Next(0, strErlaubtChar.Length)) Next Return New String(chars) Catch ex As Exception Errorlog(ex) End Try End Function