I have the following code that I'm translating from powershell to vb.net
for ($a=1; $a -le $intPasswordLength; $a++)
{
if ($a -gt 3)
{
$b = $rand.next(0,3) + $a
$b = $b % 3 + 1
} else { $b = $a }
switch ($b)
{
"1" {$b = "$strNumbers"}
"2" {$b = "$strCapitalLetters"}
"3" {$b = "$strLowerLetters"}
}
$charset = $($b)
$number = $rand.next(0,$charset.Length)
$RandomPassword += $charset[$number]
}
$RandomPassword
}
The variable $RandomPassword
is being declared and increased at the same time if I understand correctly, by the value $charset[$number]
what would be the equivalent on vb.net? how could I declare this and increase it by the value charset(number)
on vb.net?
Thanks!
This is just string concatentation and +=
works for that in VB as well:
Dim s As String = "foo"
s += " bar"