Announcement

Collapse
No announcement yet.

VB.NET -- Random Key Generator

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • VB.NET -- Random Key Generator

    Don't know if this is useful to anyone else, but I had a quick need for random strings of alphanumeric nonsense this morning, and opted to play around a create a silly class of my own to do it. Source code attached for the class. Nothing special... Used Visual Studio 2008 Express to create it.

    Example usage:
    Code:
    Dim KeyGen As New RandomKeyGenerator
    Dim myKey As String = KeyGen.Generate(40)
    Dim myKeyWithSeparator As String = KeyGen.Generate(40, 10)
    
    MsgBox(myKey, MsgBoxStyle.OkOnly, "New Key w/no Separator...")
    MsgBox(myKeyWithSeparator, MsgBoxStyle.OkOnly, "New Key with Separator...")
    Attached Files
    Play with it, 'til it's broke.

  • #2
    TextBox as MsgBox

    hi,
    you make a keygen what shot key in a MsgBox and i will upgrate it with a Generate Button and a TextBox but...

    MsgBox(myKeyWithSeparator, MsgBoxStyle.OkOnly, "New Key with Separator...")

    this i will make to textBox lile so:

    TextBox(myKeyWithSeparator, TextBoxStyle.OkOnly, "New Key with Separator...")

    have you some ideas?





    p.s. im from germany thereforce my english is so badly..

    Comment


    • #3
      hi,
      you make a keygen what shot key in a MsgBox and i will upgrate it with a Generate Button and a TextBox but...

      MsgBox(myKeyWithSeparator, MsgBoxStyle.OkOnly, "New Key with Separator...")

      this i will make to textBox lile so:

      TextBox(myKeyWithSeparator, TextBoxStyle.OkOnly, "New Key with Separator...")

      have you some ideas?





      p.s. im from germany thereforce my english is so badly.. and i think i double post sorry when not ignor this

      Comment


      • #4
        You want the value to appear in a TextBox? If that is what you want, then try this:

        Code:
        ' assume textbox is named txtKeyWithSeparator
        txtKeyWithSeparator.Text = myKeyWithSeparator
        MsgBox( ) is a function that pops u a message box. TextBox is a control on your window/form, and you will need to set the .Text property of it.

        Hope this helps.
        Play with it, 'til it's broke.

        Comment

        Working...
        X