ho risolto con un'altra cosa... però nn riesco a capire come si faccia a far si che metta nn solo numeri....
cioè per fare la stringa di numeri si mette "N" e per farla ALFANUMERICA ?

grazie

codice:
Function CreaPassword(ByVal lunghezza As Integer, ByVal tipopwd As String) As String

        Dim objRandom As New System.Random()
        Dim k As Integer = 1
        Dim intRandom As Integer
        Dim strPwd As String
 
        Do While k <= lunghezza
            If tipopwd = "N" Then 'Solo Numeri
                intRandom = objRandom.Next(48, 57)
            Else
                intRandom = objRandom.Next(48, 122)
            End If
            If (intRandom >= 48 AndAlso intRandom <= 57) OrElse (intRandom >= 65 AndAlso intRandom <= 90) OrElse (intRandom >= 97 AndAlso intRandom <= 122) Then
                strPwd += Chr(intRandom)
                k += 1
            End If
        Loop
        Return strPwd
        
    End Function