Hi this is just a small class I made for one of my projects to generate a random password from letters,numbers and special chars easy to add to your project. Hope you find it usfull

Create a new project add a class call it cPwsGen.vb
Add the code below to the class.

vbnet Code:
  1. Imports System.Text
  2.  
  3. Public Class cPwsGen
  4.     'Private variables.
  5.     Private pLen As Integer = 0
  6.     Private pPasswordType As TGenPass
  7.  
  8.     'Private password sources
  9.     Private Const Alpha As String = "abcdefghijklmnopqrstuvwxyz"
  10.     Private Const Digits = "0123456789"
  11.     Private Const Hexdecimal = "abcdef"
  12.     Private Const SpecialChars = "!@#$%^&*()<>=/\+-*"
  13.  
  14.     Public Enum TGenPass
  15.         Alpha = 0
  16.         AlphaDigit = 1
  17.         Digits = 2
  18.         Hexdecimal = 3
  19.         SpecialChar = 4
  20.         SpecialAlpha = 5
  21.         SpecialDigit = 6
  22.     End Enum
  23.  
  24.     Private Function GetPassword(ByVal Length As Integer, Optional ByVal GenType As TGenPass = TGenPass.Alpha) As String
  25.         Dim x As Integer
  26.         Dim r As Integer
  27.         Dim CharStream As String
  28.         Dim sb As StringBuilder
  29.  
  30.         sb = New StringBuilder
  31.         CharStream = vbNullString
  32.  
  33.         'Password types
  34.         Select Case GenType
  35.             Case TGenPass.Alpha
  36.                 CharStream = Alpha
  37.             Case TGenPass.Digits
  38.                 CharStream = Digits
  39.             Case TGenPass.Hexdecimal
  40.                 CharStream = Hexdecimal & Digits
  41.             Case TGenPass.AlphaDigit
  42.                 CharStream = Digits & Alpha
  43.             Case TGenPass.SpecialChar
  44.                 CharStream = SpecialChars
  45.             Case TGenPass.SpecialAlpha
  46.                 CharStream = Alpha & SpecialChars
  47.             Case TGenPass.SpecialDigit
  48.                 CharStream = Digits & SpecialChars
  49.         End Select
  50.  
  51.         For x = 1 To Length
  52.             'Ini Random numbers
  53.             Call Randomize()
  54.             'Get random number
  55.             r = Int(Rnd() * Len(CharStream) + 1)
  56.             'Build generated password.
  57.             Call sb.Append(Mid$(CharStream, r, 1))
  58.         Next x
  59.  
  60.         GetPassword = sb.ToString
  61.     End Function
  62.  
  63.     Public Property PasswordType As TGenPass
  64.         Get
  65.             'Return password type.
  66.             PasswordType = pPasswordType
  67.         End Get
  68.         Set(ByVal value As TGenPass)
  69.             'Set password type.
  70.             pPasswordType = value
  71.         End Set
  72.     End Property
  73.  
  74.     Public Property PasswordLength As Integer
  75.         Get
  76.             'Return password length.
  77.             PasswordLength = pLen
  78.         End Get
  79.         Set(ByVal value As Integer)
  80.             'Set password length.
  81.             pLen = value
  82.         End Set
  83.     End Property
  84.  
  85.     Public ReadOnly Property Password As String
  86.         Get
  87.             'Return generated password.
  88.             Password = GetPassword(PasswordLength, PasswordType)
  89.         End Get
  90.     End Property
  91. End Class

For the example add this to a command button.
vbnet Code:
  1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  2.         Dim GenPws As New cPwsGen
  3.         'Set password generator props
  4.         GenPws.PasswordLength = 8
  5.         GenPws.PasswordType = cPwsGen.TGenPass.AlphaDigit
  6.         'Example
  7.         Call MsgBox(GenPws.Password, vbInformation Or vbOKOnly, "Your Passsword")
  8.     End Sub