# Project Code: Using License Keys in vb.net



## shuggans (Sep 15, 2011)

I'm posting this code because I looked EVERYWHERE and no one had any samples to start out with.  I needed a simple way to protect a program I intend to sell from being distributed for free, without "punishing the honest user."  

You are free to use the code, just please make some not of thanks in your program. Also: if you are not a TPU forum member and use the code, I ask that you please sign up on the Tech Power Up forums and give something back (knowledge, help, etc.) to someone else in need.

This is probably by FAR NOT the best way to this, but it's all I could come up with that didn't involve hardware on the machine. I do not have a key generator to go along with it... but the following key will validate with the included project file if run:

 "0C660-A0006-0C660-G0088".

I have implemented a different final version into my own program, but here is the basic code in a nutshell.  I tried to include comments to explain as I went.  If you feel you would like to contribute and make this code better, please feel free to do so and re upload the project file for others to continue to build on.  

Kreij and Ford: Personal challenge! How would you improve this?


```
'Original Code by Sean Huggans (shuggans)
'Provided for use by Tech Power Up forum members (If you grab this code, please sign up for TPU!)
'9/13/2011

Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        TextBox_GroupA.MaxLength = 5
        TextBox_GroupB.MaxLength = 5
        TextBox_GroupC.MaxLength = 5
        TextBox_GroupD.MaxLength = 5
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        'grab all textbox strings....
        Dim GroupA As String = TextBox_GroupA.Text.ToUpper
        Dim GroupB As String = TextBox_GroupB.Text.ToUpper
        Dim GroupC As String = TextBox_GroupC.Text.ToUpper
        Dim GroupD As String = TextBox_GroupD.Text.ToUpper

        '------ check to make sure there are 5 characters in each text box... these numbers could be changed to add security or mix it up a bit.... you'd need to set the textbox maxlength above to match, and delete the corresponding strings below.
        If GroupA.Length = 5 And GroupB.Length = 5 And GroupC.Length = 5 And GroupD.Length = 5 Then

            '----- break our textbox strings into individual character strings
            Dim char1 As String = GroupA.Chars(0)
            Dim char2 As String = GroupA.Chars(1)
            Dim char3 As String = GroupA.Chars(2)
            Dim char4 As String = GroupA.Chars(3)
            Dim char5 As String = GroupA.Chars(4)

            Dim char6 As String = GroupB.Chars(0)
            Dim char7 As String = GroupB.Chars(1)
            Dim char8 As String = GroupB.Chars(2)
            Dim char9 As String = GroupB.Chars(3)
            Dim char10 As String = GroupB.Chars(4)

            Dim char11 As String = GroupC.Chars(0)
            Dim char12 As String = GroupC.Chars(1)
            Dim char13 As String = GroupC.Chars(2)
            Dim char14 As String = GroupC.Chars(3)
            Dim char15 As String = GroupC.Chars(4)

            Dim char16 As String = GroupD.Chars(0)
            Dim char17 As String = GroupD.Chars(1)
            Dim char18 As String = GroupD.Chars(2)
            Dim char19 As String = GroupD.Chars(3)
            Dim char20 As String = GroupD.Chars(4)

            '---- give all our characters a numeric value if they are letters.  I would change this up as well if you are actually going to implement this code.
            If char1 = "A" Then
                char1 = "10"
            ElseIf char1 = "B" Then
                char1 = "11"
            ElseIf char1 = "C" Then
                char1 = "12"
            ElseIf char1 = "D" Then
                char1 = "13"
            ElseIf char1 = "E" Then
                char1 = "14"
            ElseIf char1 = "F" Then
                char1 = "15"
            ElseIf char1 = "G" Then
                char1 = "16"
            ElseIf char1 = "H" Then
                char1 = "17"
            ElseIf char1 = "I" Then
                char1 = "18"
            ElseIf char1 = "J" Then
                char1 = "19"
            ElseIf char1 = "K" Then
                char1 = "20"
            ElseIf char1 = "L" Then
                char1 = "21"
            ElseIf char1 = "M" Then
                char1 = "22"
            ElseIf char1 = "N" Then
                char1 = "23"
            ElseIf char1 = "O" Then
                char1 = "24"
            ElseIf char1 = "P" Then
                char1 = "25"
            ElseIf char1 = "Q" Then
                char1 = "26"
            ElseIf char1 = "R" Then
                char1 = "27"
            ElseIf char1 = "S" Then
                char1 = "28"
            ElseIf char1 = "T" Then
                char1 = "29"
            ElseIf char1 = "U" Then
                char1 = "30"
            ElseIf char1 = "V" Then
                char1 = "31"
            ElseIf char1 = "W" Then
                char1 = "32"
            ElseIf char1 = "X" Then
                char1 = "33"
            ElseIf char1 = "Y" Then
                char1 = "34"
            ElseIf char1 = "Z" Then
                char1 = "35"
            End If
            If char2 = "A" Then
                char2 = "10"
            ElseIf char2 = "B" Then
                char2 = "11"
            ElseIf char2 = "C" Then
                char2 = "12"
            ElseIf char2 = "D" Then
                char2 = "13"
            ElseIf char2 = "E" Then
                char2 = "14"
            ElseIf char2 = "F" Then
                char2 = "15"
            ElseIf char2 = "G" Then
                char2 = "16"
            ElseIf char2 = "H" Then
                char2 = "17"
            ElseIf char2 = "I" Then
                char2 = "18"
            ElseIf char2 = "J" Then
                char2 = "19"
            ElseIf char2 = "K" Then
                char2 = "20"
            ElseIf char2 = "L" Then
                char2 = "21"
            ElseIf char2 = "M" Then
                char2 = "22"
            ElseIf char2 = "N" Then
                char2 = "23"
            ElseIf char2 = "O" Then
                char2 = "24"
            ElseIf char2 = "P" Then
                char2 = "25"
            ElseIf char2 = "Q" Then
                char2 = "26"
            ElseIf char2 = "R" Then
                char2 = "27"
            ElseIf char2 = "S" Then
                char2 = "28"
            ElseIf char2 = "T" Then
                char2 = "29"
            ElseIf char2 = "U" Then
                char2 = "30"
            ElseIf char2 = "V" Then
                char2 = "31"
            ElseIf char2 = "W" Then
                char2 = "32"
            ElseIf char2 = "X" Then
                char2 = "33"
            ElseIf char2 = "Y" Then
                char2 = "34"
            ElseIf char2 = "Z" Then
                char2 = "35"
            End If
            If char3 = "A" Then
                char3 = "10"
            ElseIf char3 = "B" Then
                char3 = "11"
            ElseIf char3 = "C" Then
                char3 = "12"
            ElseIf char3 = "D" Then
                char3 = "13"
            ElseIf char3 = "E" Then
                char3 = "14"
            ElseIf char3 = "F" Then
                char3 = "15"
            ElseIf char3 = "G" Then
                char3 = "16"
            ElseIf char3 = "H" Then
                char3 = "17"
            ElseIf char3 = "I" Then
                char3 = "18"
            ElseIf char3 = "J" Then
                char3 = "19"
            ElseIf char3 = "K" Then
                char3 = "20"
            ElseIf char3 = "L" Then
                char3 = "21"
            ElseIf char3 = "M" Then
                char3 = "22"
            ElseIf char3 = "N" Then
                char3 = "23"
            ElseIf char3 = "O" Then
                char3 = "24"
            ElseIf char3 = "P" Then
                char3 = "25"
            ElseIf char3 = "Q" Then
                char3 = "26"
            ElseIf char3 = "R" Then
                char3 = "27"
            ElseIf char3 = "S" Then
                char3 = "28"
            ElseIf char3 = "T" Then
                char3 = "29"
            ElseIf char3 = "U" Then
                char3 = "30"
            ElseIf char3 = "V" Then
                char3 = "31"
            ElseIf char3 = "W" Then
                char3 = "32"
            ElseIf char3 = "X" Then
                char3 = "33"
            ElseIf char3 = "Y" Then
                char3 = "34"
            ElseIf char3 = "Z" Then
                char3 = "35"
            End If
            If char4 = "A" Then
                char4 = "10"
            ElseIf char4 = "B" Then
                char4 = "11"
            ElseIf char4 = "C" Then
                char4 = "12"
            ElseIf char4 = "D" Then
                char4 = "13"
            ElseIf char4 = "E" Then
                char4 = "14"
            ElseIf char4 = "F" Then
                char4 = "15"
            ElseIf char4 = "G" Then
                char4 = "16"
            ElseIf char4 = "H" Then
                char4 = "17"
            ElseIf char4 = "I" Then
                char4 = "18"
            ElseIf char4 = "J" Then
                char4 = "19"
            ElseIf char4 = "K" Then
                char4 = "20"
            ElseIf char4 = "L" Then
                char4 = "21"
            ElseIf char4 = "M" Then
                char4 = "22"
            ElseIf char4 = "N" Then
                char4 = "23"
            ElseIf char4 = "O" Then
                char4 = "24"
            ElseIf char4 = "P" Then
                char4 = "25"
            ElseIf char4 = "Q" Then
                char4 = "26"
            ElseIf char4 = "R" Then
                char4 = "27"
            ElseIf char4 = "S" Then
                char4 = "28"
            ElseIf char4 = "T" Then
                char4 = "29"
            ElseIf char4 = "U" Then
                char4 = "30"
            ElseIf char4 = "V" Then
                char4 = "31"
            ElseIf char4 = "W" Then
                char4 = "32"
            ElseIf char4 = "X" Then
                char4 = "33"
            ElseIf char4 = "Y" Then
                char4 = "34"
            ElseIf char4 = "Z" Then
                char4 = "35"
            End If
            If char5 = "A" Then
                char5 = "10"
            ElseIf char5 = "B" Then
                char5 = "11"
            ElseIf char5 = "C" Then
                char5 = "12"
            ElseIf char5 = "D" Then
                char5 = "13"
            ElseIf char5 = "E" Then
                char5 = "14"
            ElseIf char5 = "F" Then
                char5 = "15"
            ElseIf char5 = "G" Then
                char5 = "16"
            ElseIf char5 = "H" Then
                char5 = "17"
            ElseIf char5 = "I" Then
                char5 = "18"
            ElseIf char5 = "J" Then
                char5 = "19"
            ElseIf char5 = "K" Then
                char5 = "20"
            ElseIf char5 = "L" Then
                char5 = "21"
            ElseIf char5 = "M" Then
                char5 = "22"
            ElseIf char5 = "N" Then
                char5 = "23"
            ElseIf char5 = "O" Then
                char5 = "24"
            ElseIf char5 = "P" Then
                char5 = "25"
            ElseIf char5 = "Q" Then
                char5 = "26"
            ElseIf char5 = "R" Then
                char5 = "27"
            ElseIf char5 = "S" Then
                char5 = "28"
            ElseIf char5 = "T" Then
                char5 = "29"
            ElseIf char5 = "U" Then
                char5 = "30"
            ElseIf char5 = "V" Then
                char5 = "31"
            ElseIf char5 = "W" Then
                char5 = "32"
            ElseIf char5 = "X" Then
                char5 = "33"
            ElseIf char5 = "Y" Then
                char5 = "34"
            ElseIf char5 = "Z" Then
                char5 = "35"
            End If

            If char6 = "A" Then
                char6 = "10"
            ElseIf char6 = "B" Then
                char6 = "11"
            ElseIf char6 = "C" Then
                char6 = "12"
            ElseIf char6 = "D" Then
                char6 = "13"
            ElseIf char6 = "E" Then
                char6 = "14"
            ElseIf char6 = "F" Then
                char6 = "15"
            ElseIf char6 = "G" Then
                char6 = "16"
            ElseIf char6 = "H" Then
                char6 = "17"
            ElseIf char6 = "I" Then
                char6 = "18"
            ElseIf char6 = "J" Then
                char6 = "19"
            ElseIf char6 = "K" Then
                char6 = "20"
            ElseIf char6 = "L" Then
                char6 = "21"
            ElseIf char6 = "M" Then
                char6 = "22"
            ElseIf char6 = "N" Then
                char6 = "23"
            ElseIf char6 = "O" Then
                char6 = "24"
            ElseIf char6 = "P" Then
                char6 = "25"
            ElseIf char6 = "Q" Then
                char6 = "26"
            ElseIf char6 = "R" Then
                char6 = "27"
            ElseIf char6 = "S" Then
                char6 = "28"
            ElseIf char6 = "T" Then
                char6 = "29"
            ElseIf char6 = "U" Then
                char6 = "30"
            ElseIf char6 = "V" Then
                char6 = "31"
            ElseIf char6 = "W" Then
                char6 = "32"
            ElseIf char6 = "X" Then
                char6 = "33"
            ElseIf char6 = "Y" Then
                char6 = "34"
            ElseIf char6 = "Z" Then
                char6 = "35"
            End If
            If char7 = "A" Then
                char7 = "10"
            ElseIf char7 = "B" Then
                char7 = "11"
            ElseIf char7 = "C" Then
                char7 = "12"
            ElseIf char7 = "D" Then
                char7 = "13"
            ElseIf char7 = "E" Then
                char7 = "14"
            ElseIf char7 = "F" Then
                char7 = "15"
            ElseIf char7 = "G" Then
                char7 = "16"
            ElseIf char7 = "H" Then
                char7 = "17"
            ElseIf char7 = "I" Then
                char7 = "18"
            ElseIf char7 = "J" Then
                char7 = "19"
            ElseIf char7 = "K" Then
                char7 = "20"
            ElseIf char7 = "L" Then
                char7 = "21"
            ElseIf char7 = "M" Then
                char7 = "22"
            ElseIf char7 = "N" Then
                char7 = "23"
            ElseIf char7 = "O" Then
                char7 = "24"
            ElseIf char7 = "P" Then
                char7 = "25"
            ElseIf char7 = "Q" Then
                char7 = "26"
            ElseIf char7 = "R" Then
                char7 = "27"
            ElseIf char7 = "S" Then
                char7 = "28"
            ElseIf char7 = "T" Then
                char7 = "29"
            ElseIf char7 = "U" Then
                char7 = "30"
            ElseIf char7 = "V" Then
                char7 = "31"
            ElseIf char7 = "W" Then
                char7 = "32"
            ElseIf char7 = "X" Then
                char7 = "33"
            ElseIf char7 = "Y" Then
                char7 = "34"
            ElseIf char7 = "Z" Then
                char7 = "35"
            End If
            If char8 = "A" Then
                char8 = "10"
            ElseIf char8 = "B" Then
                char8 = "11"
            ElseIf char8 = "C" Then
                char8 = "12"
            ElseIf char8 = "D" Then
                char8 = "13"
            ElseIf char8 = "E" Then
                char8 = "14"
            ElseIf char8 = "F" Then
                char8 = "15"
            ElseIf char8 = "G" Then
                char8 = "16"
            ElseIf char8 = "H" Then
                char8 = "17"
            ElseIf char8 = "I" Then
                char8 = "18"
            ElseIf char8 = "J" Then
                char8 = "19"
            ElseIf char8 = "K" Then
                char8 = "20"
            ElseIf char8 = "L" Then
                char8 = "21"
            ElseIf char8 = "M" Then
                char8 = "22"
            ElseIf char8 = "N" Then
                char8 = "23"
            ElseIf char8 = "O" Then
                char8 = "24"
            ElseIf char8 = "P" Then
                char8 = "25"
            ElseIf char8 = "Q" Then
                char8 = "26"
            ElseIf char8 = "R" Then
                char8 = "27"
            ElseIf char8 = "S" Then
                char8 = "28"
            ElseIf char8 = "T" Then
                char8 = "29"
            ElseIf char8 = "U" Then
                char8 = "30"
            ElseIf char8 = "V" Then
                char8 = "31"
            ElseIf char8 = "W" Then
                char8 = "32"
            ElseIf char8 = "X" Then
                char8 = "33"
            ElseIf char8 = "Y" Then
                char8 = "34"
            ElseIf char8 = "Z" Then
                char8 = "35"
            End If
            If char9 = "A" Then
                char9 = "10"
            ElseIf char9 = "B" Then
                char9 = "11"
            ElseIf char9 = "C" Then
                char9 = "12"
            ElseIf char9 = "D" Then
                char9 = "13"
            ElseIf char9 = "E" Then
                char9 = "14"
            ElseIf char9 = "F" Then
                char9 = "15"
            ElseIf char9 = "G" Then
                char9 = "16"
            ElseIf char9 = "H" Then
                char9 = "17"
            ElseIf char9 = "I" Then
                char9 = "18"
            ElseIf char9 = "J" Then
                char9 = "19"
            ElseIf char9 = "K" Then
                char9 = "20"
            ElseIf char9 = "L" Then
                char9 = "21"
            ElseIf char9 = "M" Then
                char9 = "22"
            ElseIf char9 = "N" Then
                char9 = "23"
            ElseIf char9 = "O" Then
                char9 = "24"
            ElseIf char9 = "P" Then
                char9 = "25"
            ElseIf char9 = "Q" Then
                char9 = "26"
            ElseIf char9 = "R" Then
                char9 = "27"
            ElseIf char9 = "S" Then
                char9 = "28"
            ElseIf char9 = "T" Then
                char9 = "29"
            ElseIf char9 = "U" Then
                char9 = "30"
            ElseIf char9 = "V" Then
                char9 = "31"
            ElseIf char9 = "W" Then
                char9 = "32"
            ElseIf char9 = "X" Then
                char9 = "33"
            ElseIf char9 = "Y" Then
                char9 = "34"
            ElseIf char9 = "Z" Then
                char9 = "35"
            End If
            If char10 = "A" Then
                char10 = "10"
            ElseIf char10 = "B" Then
                char10 = "11"
            ElseIf char10 = "C" Then
                char10 = "12"
            ElseIf char10 = "D" Then
                char10 = "13"
            ElseIf char10 = "E" Then
                char10 = "14"
            ElseIf char10 = "F" Then
                char10 = "15"
            ElseIf char10 = "G" Then
                char10 = "16"
            ElseIf char10 = "H" Then
                char10 = "17"
            ElseIf char10 = "I" Then
                char10 = "18"
            ElseIf char10 = "J" Then
                char10 = "19"
            ElseIf char10 = "K" Then
                char10 = "20"
            ElseIf char10 = "L" Then
                char10 = "21"
            ElseIf char10 = "M" Then
                char10 = "22"
            ElseIf char10 = "N" Then
                char10 = "23"
            ElseIf char10 = "O" Then
                char10 = "24"
            ElseIf char10 = "P" Then
                char10 = "25"
            ElseIf char10 = "Q" Then
                char10 = "26"
            ElseIf char10 = "R" Then
                char10 = "27"
            ElseIf char10 = "S" Then
                char10 = "28"
            ElseIf char10 = "T" Then
                char10 = "29"
            ElseIf char10 = "U" Then
                char10 = "30"
            ElseIf char10 = "V" Then
                char10 = "31"
            ElseIf char10 = "W" Then
                char10 = "32"
            ElseIf char10 = "X" Then
                char10 = "33"
            ElseIf char10 = "Y" Then
                char10 = "34"
            ElseIf char10 = "Z" Then
                char10 = "35"
            End If

            If char11 = "A" Then
                char11 = "10"
            ElseIf char11 = "B" Then
                char11 = "11"
            ElseIf char11 = "C" Then
                char11 = "12"
            ElseIf char11 = "D" Then
                char11 = "13"
            ElseIf char11 = "E" Then
                char11 = "14"
            ElseIf char11 = "F" Then
                char11 = "15"
            ElseIf char11 = "G" Then
                char11 = "16"
            ElseIf char11 = "H" Then
                char11 = "17"
            ElseIf char11 = "I" Then
                char11 = "18"
            ElseIf char11 = "J" Then
                char11 = "19"
            ElseIf char11 = "K" Then
                char11 = "20"
            ElseIf char11 = "L" Then
                char11 = "21"
            ElseIf char11 = "M" Then
                char11 = "22"
            ElseIf char11 = "N" Then
                char11 = "23"
            ElseIf char11 = "O" Then
                char11 = "24"
            ElseIf char11 = "P" Then
                char11 = "25"
            ElseIf char11 = "Q" Then
                char11 = "26"
            ElseIf char11 = "R" Then
                char11 = "27"
            ElseIf char11 = "S" Then
                char11 = "28"
            ElseIf char11 = "T" Then
                char11 = "29"
            ElseIf char11 = "U" Then
                char11 = "30"
            ElseIf char11 = "V" Then
                char11 = "31"
            ElseIf char11 = "W" Then
                char11 = "32"
            ElseIf char11 = "X" Then
                char11 = "33"
            ElseIf char11 = "Y" Then
                char11 = "34"
            ElseIf char11 = "Z" Then
                char11 = "35"
            End If

            If char12 = "A" Then
                char12 = "10"
            ElseIf char12 = "B" Then
                char12 = "11"
            ElseIf char12 = "C" Then
                char12 = "12"
            ElseIf char12 = "D" Then
                char12 = "13"
            ElseIf char12 = "E" Then
                char12 = "14"
            ElseIf char12 = "F" Then
                char12 = "15"
            ElseIf char12 = "G" Then
                char12 = "16"
            ElseIf char12 = "H" Then
                char12 = "17"
            ElseIf char12 = "I" Then
                char12 = "18"
            ElseIf char12 = "J" Then
                char12 = "19"
            ElseIf char12 = "K" Then
                char12 = "20"
            ElseIf char12 = "L" Then
                char12 = "21"
            ElseIf char12 = "M" Then
                char12 = "22"
            ElseIf char12 = "N" Then
                char12 = "23"
            ElseIf char12 = "O" Then
                char12 = "24"
            ElseIf char12 = "P" Then
                char12 = "25"
            ElseIf char12 = "Q" Then
                char12 = "26"
            ElseIf char12 = "R" Then
                char12 = "27"
            ElseIf char12 = "S" Then
                char12 = "28"
            ElseIf char12 = "T" Then
                char12 = "29"
            ElseIf char12 = "U" Then
                char12 = "30"
            ElseIf char12 = "V" Then
                char12 = "31"
            ElseIf char12 = "W" Then
                char12 = "32"
            ElseIf char12 = "X" Then
                char12 = "33"
            ElseIf char12 = "Y" Then
                char12 = "34"
            ElseIf char12 = "Z" Then
                char12 = "35"
            End If

            If char13 = "A" Then
                char13 = "10"
            ElseIf char13 = "B" Then
                char13 = "11"
            ElseIf char13 = "C" Then
                char13 = "12"
            ElseIf char13 = "D" Then
                char13 = "13"
            ElseIf char13 = "E" Then
                char13 = "14"
            ElseIf char13 = "F" Then
                char13 = "15"
            ElseIf char13 = "G" Then
                char13 = "16"
            ElseIf char13 = "H" Then
                char13 = "17"
            ElseIf char13 = "I" Then
                char13 = "18"
            ElseIf char13 = "J" Then
                char13 = "19"
            ElseIf char13 = "K" Then
                char13 = "20"
            ElseIf char13 = "L" Then
                char13 = "21"
            ElseIf char13 = "M" Then
                char13 = "22"
            ElseIf char13 = "N" Then
                char13 = "23"
            ElseIf char13 = "O" Then
                char13 = "24"
            ElseIf char13 = "P" Then
                char13 = "25"
            ElseIf char13 = "Q" Then
                char13 = "26"
            ElseIf char13 = "R" Then
                char13 = "27"
            ElseIf char13 = "S" Then
                char13 = "28"
            ElseIf char13 = "T" Then
                char13 = "29"
            ElseIf char13 = "U" Then
                char13 = "30"
            ElseIf char13 = "V" Then
                char13 = "31"
            ElseIf char13 = "W" Then
                char13 = "32"
            ElseIf char13 = "X" Then
                char13 = "33"
            ElseIf char13 = "Y" Then
                char13 = "34"
            ElseIf char13 = "Z" Then
                char13 = "35"
            End If

            If char14 = "A" Then
                char14 = "10"
            ElseIf char14 = "B" Then
                char14 = "11"
            ElseIf char14 = "C" Then
                char14 = "12"
            ElseIf char14 = "D" Then
                char14 = "13"
            ElseIf char14 = "E" Then
                char14 = "14"
            ElseIf char14 = "F" Then
                char14 = "15"
            ElseIf char14 = "G" Then
                char14 = "16"
            ElseIf char14 = "H" Then
                char14 = "17"
            ElseIf char14 = "I" Then
                char14 = "18"
            ElseIf char14 = "J" Then
                char14 = "19"
            ElseIf char14 = "K" Then
                char14 = "20"
            ElseIf char14 = "L" Then
                char14 = "21"
            ElseIf char14 = "M" Then
                char14 = "22"
            ElseIf char14 = "N" Then
                char14 = "23"
            ElseIf char14 = "O" Then
                char14 = "24"
            ElseIf char14 = "P" Then
                char14 = "25"
            ElseIf char14 = "Q" Then
                char14 = "26"
            ElseIf char14 = "R" Then
                char14 = "27"
            ElseIf char14 = "S" Then
                char14 = "28"
            ElseIf char14 = "T" Then
                char14 = "29"
            ElseIf char14 = "U" Then
                char14 = "30"
            ElseIf char14 = "V" Then
                char14 = "31"
            ElseIf char14 = "W" Then
                char14 = "32"
            ElseIf char14 = "X" Then
                char14 = "33"
            ElseIf char14 = "Y" Then
                char14 = "34"
            ElseIf char14 = "Z" Then
                char14 = "35"
            End If

            If char15 = "A" Then
                char15 = "10"
            ElseIf char15 = "B" Then
                char15 = "11"
            ElseIf char15 = "C" Then
                char15 = "12"
            ElseIf char15 = "D" Then
                char15 = "13"
            ElseIf char15 = "E" Then
                char15 = "14"
            ElseIf char15 = "F" Then
                char15 = "15"
            ElseIf char15 = "G" Then
                char15 = "16"
            ElseIf char15 = "H" Then
                char15 = "17"
            ElseIf char15 = "I" Then
                char15 = "18"
            ElseIf char15 = "J" Then
                char15 = "19"
            ElseIf char15 = "K" Then
                char15 = "20"
            ElseIf char15 = "L" Then
                char15 = "21"
            ElseIf char15 = "M" Then
                char15 = "22"
            ElseIf char15 = "N" Then
                char15 = "23"
            ElseIf char15 = "O" Then
                char15 = "24"
            ElseIf char15 = "P" Then
                char15 = "25"
            ElseIf char15 = "Q" Then
                char15 = "26"
            ElseIf char15 = "R" Then
                char15 = "27"
            ElseIf char15 = "S" Then
                char15 = "28"
            ElseIf char15 = "T" Then
                char15 = "29"
            ElseIf char15 = "U" Then
                char15 = "30"
            ElseIf char15 = "V" Then
                char15 = "31"
            ElseIf char15 = "W" Then
                char15 = "32"
            ElseIf char15 = "X" Then
                char15 = "33"
            ElseIf char15 = "Y" Then
                char15 = "34"
            ElseIf char15 = "Z" Then
                char15 = "35"
            End If


            If char16 = "A" Then
                char16 = "10"
            ElseIf char16 = "B" Then
                char16 = "11"
            ElseIf char16 = "C" Then
                char16 = "12"
            ElseIf char16 = "D" Then
                char16 = "13"
            ElseIf char16 = "E" Then
                char16 = "14"
            ElseIf char16 = "F" Then
                char16 = "15"
            ElseIf char16 = "G" Then
                char16 = "16"
            ElseIf char16 = "H" Then
                char16 = "17"
            ElseIf char16 = "I" Then
                char16 = "18"
            ElseIf char16 = "J" Then
                char16 = "19"
            ElseIf char16 = "K" Then
                char16 = "20"
            ElseIf char16 = "L" Then
                char16 = "21"
            ElseIf char16 = "M" Then
                char16 = "22"
            ElseIf char16 = "N" Then
                char16 = "23"
            ElseIf char16 = "O" Then
                char16 = "24"
            ElseIf char16 = "P" Then
                char16 = "25"
            ElseIf char16 = "Q" Then
                char16 = "26"
            ElseIf char16 = "R" Then
                char16 = "27"
            ElseIf char16 = "S" Then
                char16 = "28"
            ElseIf char16 = "T" Then
                char16 = "29"
            ElseIf char16 = "U" Then
                char16 = "30"
            ElseIf char16 = "V" Then
                char16 = "31"
            ElseIf char16 = "W" Then
                char16 = "32"
            ElseIf char16 = "X" Then
                char16 = "33"
            ElseIf char16 = "Y" Then
                char16 = "34"
            ElseIf char16 = "Z" Then
                char16 = "35"
            End If

            If char17 = "A" Then
                char17 = "10"
            ElseIf char17 = "B" Then
                char17 = "11"
            ElseIf char17 = "C" Then
                char17 = "12"
            ElseIf char17 = "D" Then
                char17 = "13"
            ElseIf char17 = "E" Then
                char17 = "14"
            ElseIf char17 = "F" Then
                char17 = "15"
            ElseIf char17 = "G" Then
                char17 = "16"
            ElseIf char17 = "H" Then
                char17 = "17"
            ElseIf char17 = "I" Then
                char17 = "18"
            ElseIf char17 = "J" Then
                char17 = "19"
            ElseIf char17 = "K" Then
                char17 = "20"
            ElseIf char17 = "L" Then
                char17 = "21"
            ElseIf char17 = "M" Then
                char17 = "22"
            ElseIf char17 = "N" Then
                char17 = "23"
            ElseIf char17 = "O" Then
                char17 = "24"
            ElseIf char17 = "P" Then
                char17 = "25"
            ElseIf char17 = "Q" Then
                char17 = "26"
            ElseIf char17 = "R" Then
                char17 = "27"
            ElseIf char17 = "S" Then
                char17 = "28"
            ElseIf char17 = "T" Then
                char17 = "29"
            ElseIf char17 = "U" Then
                char17 = "30"
            ElseIf char17 = "V" Then
                char17 = "31"
            ElseIf char17 = "W" Then
                char17 = "32"
            ElseIf char17 = "X" Then
                char17 = "33"
            ElseIf char17 = "Y" Then
                char17 = "34"
            ElseIf char17 = "Z" Then
                char17 = "35"
            End If
            If char18 = "A" Then
                char18 = "10"
            ElseIf char18 = "B" Then
                char18 = "11"
            ElseIf char18 = "C" Then
                char18 = "12"
            ElseIf char18 = "D" Then
                char18 = "13"
            ElseIf char18 = "E" Then
                char18 = "14"
            ElseIf char18 = "F" Then
                char18 = "15"
            ElseIf char18 = "G" Then
                char18 = "16"
            ElseIf char18 = "H" Then
                char18 = "17"
            ElseIf char18 = "I" Then
                char18 = "18"
            ElseIf char18 = "J" Then
                char18 = "19"
            ElseIf char18 = "K" Then
                char18 = "20"
            ElseIf char18 = "L" Then
                char18 = "21"
            ElseIf char18 = "M" Then
                char18 = "22"
            ElseIf char18 = "N" Then
                char18 = "23"
            ElseIf char18 = "O" Then
                char18 = "24"
            ElseIf char18 = "P" Then
                char18 = "25"
            ElseIf char18 = "Q" Then
                char18 = "26"
            ElseIf char18 = "R" Then
                char18 = "27"
            ElseIf char18 = "S" Then
                char18 = "28"
            ElseIf char18 = "T" Then
                char18 = "29"
            ElseIf char18 = "U" Then
                char18 = "30"
            ElseIf char18 = "V" Then
                char18 = "31"
            ElseIf char18 = "W" Then
                char18 = "32"
            ElseIf char18 = "X" Then
                char18 = "33"
            ElseIf char18 = "Y" Then
                char18 = "34"
            ElseIf char18 = "Z" Then
                char18 = "35"
            End If
            If char19 = "A" Then
                char19 = "10"
            ElseIf char19 = "B" Then
                char19 = "11"
            ElseIf char19 = "C" Then
                char19 = "12"
            ElseIf char19 = "D" Then
                char19 = "13"
            ElseIf char19 = "E" Then
                char19 = "14"
            ElseIf char19 = "F" Then
                char19 = "15"
            ElseIf char19 = "G" Then
                char19 = "16"
            ElseIf char19 = "H" Then
                char19 = "17"
            ElseIf char19 = "I" Then
                char19 = "18"
            ElseIf char19 = "J" Then
                char19 = "19"
            ElseIf char19 = "K" Then
                char19 = "20"
            ElseIf char19 = "L" Then
                char19 = "21"
            ElseIf char19 = "M" Then
                char19 = "22"
            ElseIf char19 = "N" Then
                char19 = "23"
            ElseIf char19 = "O" Then
                char19 = "24"
            ElseIf char19 = "P" Then
                char19 = "25"
            ElseIf char19 = "Q" Then
                char19 = "26"
            ElseIf char19 = "R" Then
                char19 = "27"
            ElseIf char19 = "S" Then
                char19 = "28"
            ElseIf char19 = "T" Then
                char19 = "29"
            ElseIf char19 = "U" Then
                char19 = "30"
            ElseIf char19 = "V" Then
                char19 = "31"
            ElseIf char19 = "W" Then
                char19 = "32"
            ElseIf char19 = "X" Then
                char19 = "33"
            ElseIf char19 = "Y" Then
                char19 = "34"
            ElseIf char19 = "Z" Then
                char19 = "35"
            End If
            If char20 = "A" Then
                char20 = "10"
            ElseIf char20 = "B" Then
                char20 = "11"
            ElseIf char20 = "C" Then
                char20 = "12"
            ElseIf char20 = "D" Then
                char20 = "13"
            ElseIf char20 = "E" Then
                char20 = "14"
            ElseIf char20 = "F" Then
                char20 = "15"
            ElseIf char20 = "G" Then
                char20 = "16"
            ElseIf char20 = "H" Then
                char20 = "17"
            ElseIf char20 = "I" Then
                char20 = "18"
            ElseIf char20 = "J" Then
                char20 = "19"
            ElseIf char20 = "K" Then
                char20 = "20"
            ElseIf char20 = "L" Then
                char20 = "21"
            ElseIf char20 = "M" Then
                char20 = "22"
            ElseIf char20 = "N" Then
                char20 = "23"
            ElseIf char20 = "O" Then
                char20 = "24"
            ElseIf char20 = "P" Then
                char20 = "25"
            ElseIf char20 = "Q" Then
                char20 = "26"
            ElseIf char20 = "R" Then
                char20 = "27"
            ElseIf char20 = "S" Then
                char20 = "28"
            ElseIf char20 = "T" Then
                char20 = "29"
            ElseIf char20 = "U" Then
                char20 = "30"
            ElseIf char20 = "V" Then
                char20 = "31"
            ElseIf char20 = "W" Then
                char20 = "32"
            ElseIf char20 = "X" Then
                char20 = "33"
            ElseIf char20 = "Y" Then
                char20 = "34"
            ElseIf char20 = "Z" Then
                char20 = "35"
            End If

            '----- if none of the characters are spaces:
            If char1 <> " " And char2 <> " " And char3 <> " " And char4 <> " " And char5 <> " " And char6 <> " " And char7 <> " " And char8 <> " " And char9 <> " " And char10 <> " " And char11 <> " " And char12 <> " " And char13 <> " " And char14 <> " " And char15 <> " " And char16 <> " " And char17 <> " " And char18 <> " " And char19 <> " " And char20 <> " " Then

                '------- Now that all our values are numeric, we can add them as integers within the same group they where entered in....(you could change this up too... it'd get complex quick though)
                Dim Group1 As Integer = Int(char5) + Int(char4) + Int(char3) + Int(char2) + Int(char1)
                Dim Group2 As Integer = Int(char10) + Int(char9) + Int(char8) + Int(char7) + Int(char6)
                Dim Group3 As Integer = Int(char15) + Int(char14) + Int(char13) + Int(char12) + Int(char11)
                Dim Group4 As Integer = Int(char20) + Int(char19) + Int(char18) + Int(char17) + Int(char16)

                '--------- I would take everything other than the nested if on this part out if you actually use the code in your program.  The good\bad labels and text boxes are just for your own testing. -----------
                TextBox_Result.Text = Group1
                TextBox_Result2.Text = Group2
                TextBox_Result3.Text = Group3
                TextBox_Result4.Text = Group4
                '-----All fields in the end will equal 96 for this sample.  All groups could equal 24 if you like.  BUT we'll mix it up to avoid using the same set accross all fields.  we -8 from one field, and must add it to another.
                'group a must = 24
                If Group1 = 24 Then
                    Label_GroupA_Val.Text = "Good"
                    'group b must = 16
                    If Group2 = 16 Then
                        Label_GroupB_Val.Text = "Good"
                        'group c must = 24
                        If Group3 = 24 Then
                            Label_GroupC_Val.Text = "Good"
                            'group d must = 32
                            If Group4 = 32 Then
                                Label_GroupD_Val.Text = "Good"
                                '------------------- If all four of our seperate groups add up to 96(this can be changed), validate!
                                If Group1 + Group2 + Group3 + Group4 = 96 Then
                                    Label_FinalVal.ForeColor = Color.Green
                                    Label_FinalVal.Text = "Validated"
                                    '---------- my.settings.ValidationCheckSetting=true
                                Else
                                    Label_FinalVal.ForeColor = Color.Red
                                    Label_FinalVal.Text = "Invalid Key"
                                End If
                            Else
                                Label_GroupD_Val.Text = "Bad"
                                Label_FinalVal.ForeColor = Color.Red
                                Label_FinalVal.Text = "Invalid Key"
                            End If
                        Else
                            Label_GroupC_Val.Text = "Bad"
                            Label_FinalVal.ForeColor = Color.Red
                            Label_FinalVal.Text = "Invalid Key"
                        End If
                    Else
                        Label_GroupB_Val.Text = "Bad"
                        Label_FinalVal.ForeColor = Color.Red
                        Label_FinalVal.Text = "Invalid Key"
                    End If
                Else
                    Label_GroupA_Val.Text = "Bad"
                    Label_FinalVal.ForeColor = Color.Red
                    Label_FinalVal.Text = "Invalid Key"
                End If
                '---^^^^^^^^^^^^^^^^^^^^ END OF TO TAKE OUT ^^^^^^^^^^^^^^^^^--
            Else
                Label_FinalVal.ForeColor = Color.Red
                Label_FinalVal.Text = "Key is not valid, check key for spaces."
            End If
        Else
            Label_FinalVal.ForeColor = Color.Red
            Label_FinalVal.Text = "Key is not valid, please check the key and try again"
        End If
    End Sub
End Class
```

I have a key generator that is about half done.  If anyone knows how to add items to a listbox on a thread other than the main thread, let me know, and I'll finish that up and post it here as well.


----------

