Sto usando questo codice per generare una pwd casuale con .NET/VB ma ricevo un errore
L'errore è quiCodice PHP:Dim Num As New Random(100)
Dim LCases As New Random(500)
Dim UCases As New Random(50)
Dim Psw As String = ""
Dim SelezioneRandom As New Random(50)
Dim i As Integer
Dim Cnt(2) As Integer
Dim CharSel(2) As Integer
Dim ISel As Integer
Dim lunghezza As Integer = 7
For i = 1 To Lunghezza
Cnt(0) = Num.Next(48, 57)
Cnt(1) = LCases.Next(65, 90)
Cnt(2) = UCases.Next(97, 122)
CharSel(0) = System.Convert.ToChar(Cnt(0)).ToString
CharSel(1) = System.Convert.ToChar(Cnt(1)).ToString
CharSel(2) = System.Convert.ToChar(Cnt(2)).ToString
ISel = SelezioneRandom.Next(0, 3)
Psw &= CharSel(ISel)
Next
Siccome non sono praticissima di .NET e mi sto sforzando molto :master: non è che mi dareste un piccolo suggerimento?codice:CharSel(1) = System.Convert.ToChar(Cnt(1)).ToString System.FormatException: Input string was not in a correct format. StackTrace: [InvalidCastException: Conversion from string "X" to type 'Integer' is not valid.]

Rispondi quotando
