Results 1 to 4 of 4

Thread: Word, Passowrd, number, sybols generator

  1. #1

    Thread Starter
    Frenzied Member met0555's Avatar
    Join Date
    Jul 2006
    Posts
    1,385

    Word, Passowrd, number, sybols generator

    Code:
    Public Function PasswordGenerator(ByVal lngLength As Long) _
      As String
    
            On Error GoTo Err_Proc
            Dim strResult As String
    
            Dim iChr As Integer
            Dim c As Long
    
            Dim iAsc As String
    
    
    
            For c = 1 To lngLength
    
                ' Randomly decide what set of ASCII chars we will use
                iAsc = Int(3 * Rnd() + 1)
    
                'Randomly pick a char from the random set
                Select Case iAsc
                    Case 1
                        iChr = Int((Asc("Z") - Asc("A") + 1) * Rnd() + Asc("A"))
                    Case 2
                        iChr = Int((Asc("z") - Asc("a") + 1) * Rnd() + Asc("a"))
                    Case 3
                        iChr = Str((Asc(" ") - Asc("@") + 1) * Rnd() + Asc("@"))
                    Case 3
                        iChr = Asc((Asc("9") - Asc("0") + 1) * Rnd() + Asc("0"))
                    Case Else
                        Err.Raise(20000, , "PasswordGenerator has a problem.")
                End Select
    
                strResult = strResult & Chr(iChr)
    
            Next c
    
            PasswordGenerator = strResult
    
    Exit_Proc:
            Exit Function
    
    Err_Proc:
            MsgBox(Err.Number & ": " & Err.Description, _
               vbOKOnly + vbCritical)
            PasswordGenerator = vbNullString
            Resume Exit_Proc
    
        End Function

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Word, Passowrd, number, sybols generator

    Moved To VB6 CodeBank

  3. #3

    Thread Starter
    Frenzied Member met0555's Avatar
    Join Date
    Jul 2006
    Posts
    1,385

    Re: Word, Passowrd, number, sybols generator

    but it's works on VB.NET 3.5 and ASP.NET 3.5

  4. #4
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Word, Passowrd, number, sybols generator

    You're using labels and GOTOs and Int() and Asc() and Err, though, none of which should be used in VB.NET.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width