Random string generator | VB2008

By Virtual Insanity on Mar 12, 2011

So, after 3-4 years of inactivity I decided to return to Hawkee, my old account was 'Criminal'.

I'm not sure if this is the right section to post this snippet in, kinda unclear. Also I think it's weird to post a VB snippet without having a close look at the form itself. So I'll provide a screenshot to help you out. It's a single string generator, if you're planning on learning .NET or other languages, I'm sure this tool will be a life safer. You can adjust the length of each string by changing the Convert.ToDecimal(NumericUpDown1.Text) to either a static value like 75, be creative.

Another feature this snippet has is that it automatically copies the string to your clipboard.

Image

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim num_characters As Integer
        Dim i As Integer
        Dim txt1 As String
        Dim ch As Integer
        Randomize()
        num_characters = Convert.ToDecimal(NumericUpDown1.Text)
        For i = 1 To num_characters
            ch = Int((26 + 26 + 10) * Rnd())
            If ch < 26 Then
                txt1 = txt1 & Chr(ch + Asc("A"))
            ElseIf ch < 2 * 26 Then
                ch = ch - 26
                txt1 = txt1 & Chr(ch + Asc("a"))
            Else
                ch = ch - 26 - 26
                txt1 = txt1 & Chr(ch + Asc("0"))
            End If
        Next i
        TextBox1.Text = txt1
        Clipboard.Clear()
        Clipboard.SetText(TextBox1.Text)

    End Sub
Sign in to comment.
sunslayer   -  Mar 12, 2011

you can post this as a script and upload multiple files

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.