Results 1 to 13 of 13

Thread: random characters

Threaded View

  1. #2
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,897

    Re: random characters

    A hint

    Code:
        Dim prng As New Random
    
        Private Sub Button1_Click(ByVal sender As System.Object, _
                                  ByVal e As System.EventArgs) Handles Button1.Click
    
            Dim allowedCH As New System.Text.StringBuilder("`1234567890-=~!@#$&#37;^&*()_+qwertyuiop[]\QWERTYUIOP{}|asdfghjkl;'ASDFGHJKL:""zxcvbnm,./ZXCVBNM<>?")
            Dim newRandCharString As New System.Text.StringBuilder
    
            Stop
            'press F8 and use the debugger to gain understanding
    
            Do While allowedCH.Length > 0
                Dim idx As Integer = prng.Next(allowedCH.Length)
                newRandCharString.Append(allowedCH(idx))
                allowedCH.Remove(idx, 1)
            Loop
            Debug.WriteLine(newRandCharString.ToString)
        End Sub
    Last edited by dbasnett; Dec 12th, 2010 at 08:26 PM.
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width