Support Forums

Full Version: [TuT] How to create a Simple Keygen?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
[TuT] How to create a Simple Keygen?




Description:

Code:
For Generate

Dim Key As Integer
Key = Int( Rnd() * 6)
Select case Key
Case 1
Text Box 1. Text = " 858-787-767-809"
Case 2
Text Box 1. Text = " 158-787-767-809"
Case 3
Text Box 1. Text = " 558-787-767-809"
Case 4
Text Box 1. Text = " 358-787-767-809"
Case 5
Text Box 1. Text = " 658-787-767-809"
Case 6
Text Box 1. Text = " 758-787-767-809"


For Exit

End

Why is your code so jumbled up? And also you don't end your case statement.


Although i'm confused as to why you're making it even that difficult. Try something like this:
Code:
Public KeyA() As String = {"key1", "key2", "key3", "key4", "key5"}

    Private Shared Function ReturnKey(ByVal InputArray() As String, ByVal LastKeyIndex As Integer)
        Dim Key As New Random
        Return InputArray(Key.Next(0, LastKeyIndex))
    End Function

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        MsgBox(ReturnKey(KeyA, 4))
    End Sub
Thanks for the suggestion dude.
You should also have posted a text one.

But it is done. Big Grin
(01-10-2012, 07:25 AM)Techie. Wrote: [ -> ]You should also have posted a text one.

But it is done. Big Grin

A text one? It is already in text, you create the keys and put them in manually though.
Hmm... Interesting source code. Thanks for the contribution.
This is very helpful, especially to new users. Good job!