randomstring

 

Imports System.Text
 
Public Class Form1
 
  Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
    Dim s As String = “ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz”
    Dim r As New Random
    Dim sb As New StringBuilder
 
    For i As Integer = 1 To 8
      Dim idx As Integer = r.Next(0, 61)
      sb.Append(s.Substring(idx, 1))
    Next
 
    TextBox1.Text = sb.ToString
  End Sub
End Class