.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Code Snippets >> Visual Studio >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Key generator

Posted By:laptop charles       Posted Date: June 30, 2010    Points: 10    Category: Visual Studio    URL: http://www.dotnetspark.com  

Just simple key generator.
 

It can used random generation method.
And simple select case.
Public Class Form1
    Dim key As Integer
    Dim a As Integer = 0


    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click


        key = Int(Rnd() * 10)

        txtgenarator.Text = 0


            Select key
            Case 1
                txtgenarator.Text = 1
            Case 2
                txtgenarator.Text = 2
            Case 3
                txtgenarator.Text = 3
            Case 4
                txtgenarator.Text = 4
            Case 5
                txtgenarator.Text = 5
            Case 6
                txtgenarator.Text = 6
            Case 7
                txtgenarator.Text = 7
            Case 8
                txtgenarator.Text = 8
            Case 9
                txtgenarator.Text = 9
            Case 10
                txtgenarator.Text = 0
        End Select

        key = Int(Rnd() * 10)




        Select Case key
            Case 1
                txtgenarator.Text = txtgenarator.Text & 1
            Case 2
                txtgenarator.Text = txtgenarator.Text & 2
            Case 3
                txtgenarator.Text = txtgenarator.Text & 3
            Case 4
                txtgenarator.Text = txtgenarator.Text & 4
            Case 5
                txtgenarator.Text = txtgenarator.Text & 5
            Case 6
                txtgenarator.Text = txtgenarator.Text & 6
            Case 7
                txtgenarator.Text = txtgenarator.Text & 7
            Case 8
                txtgenarator.Text = txtgenarator.Text & 8
            Case 9
                txtgenarator.Text = txtgenarator.Text & 9
            Case 10
                txtgenarator.Text = txtgenarator.Text & 0
        End Select
        key = Int(Rnd() * 10)




        Select Case key
            Case 1
                txtgenarator.Text = txtgenarator.Text & 1
            Case 2
                txtgenarator.Text = txtgenarator.Text & 2
            Case 3
                txtgenarator.Text = txtgenarator.Text & 3
            Case 4
                txtgenarator.Text = txtgenarator.Text & 4
            Case 5
                txtgenarator.Text = txtgenarator.Text & 5
            Case 6
                txtgenarator.Text = txtgenarator.Text & 6
            Case 7
                txtgenarator.Text = txtgenarator.Text & 7
            Case 8
                txtgenarator.Text = txtgenarator.Text & 8
            Case 9
                txtgenarator.Text = txtgenarator.Text & 9
            Case 10
                txtgenarator.Text = txtgenarator.Text & 0
        End Select

        key = Int(Rnd() * 10)




        Select Case key
            Case 1
                txtgenarator.Text = txtgenarator.Text & 1
            Case 2
                txtgenarator.Text = txtgenarator.Text & 2
            Case 3
                txtgenarator.Text = txtgenarator.Text & 3
            Case 4
                txtgenarator.Text = txtgenarator.Text & 4
            Case 5
                txtgenarator.Text = txtgenarator.Text & 5
            Case 6
                txtgenarator.Text = txtgenarator.Text & 6
            Case 7
                txtgenarator.Text = txtgenarator.Text & 7
            Case 8
                txtgenarator.Text = txtgenarator.Text & 8
            Case 9
                txtgenarator.Text = txtgenarator.Text & 9
            Case 10
                txtgenarator.Text = txtgenarator.Text & 0
        End Select

        key = Int(Rnd() * 10)

        txtgenarator.Text = txtgenarator.Text & "-"


        Select Case key
            Case 1
                txtgenarator.Text = txtgenarator.Text & 1
            Case 2
                txtgenarator.Text = txtgenarator.Text & 2
            Case 3
                txtgenarator.Text = txtgenarator.Text & 3
            Case 4
                txtgenarator.Text = txtgenarator.Text & 4
            Case 5
                txtgenarator.Text = txtgenarator.Text & 5
            Case 6
                txtgenarator.Text = txtgenarator.Text & 6
            Case 7
                txtgenarator.Text = txtgenarator.Text & 7
            Case 8
                txtgenarator.Text = txtgenarator.Text & 8
            Case 9
                txtgenarator.Text = txtgenarator.Text & 9
            Case 10
                txtgenarator.Text = txtgenarator.Text & 0
        End Select

        key = Int(Rnd() * 10)




        Select Case key
            Case 1
                txtgenarator.Text = txtgenarator.Text & 1
            Case 2
                txtgenarator.Text = txtgenarator.Text & 2
            Case 3
                txtgenarator.Text = txtgenarator.Text & 3
            Case 4
                txtgenarator.Text = txtgenarator.Text & 4
            Case 5
                txtgenarator.Text = txtgenarator.Text & 5
            Case 6
                txtgenarator.Text = txtgenarator.Text & 6
            Case 7
                txtgenarator.Text = txtgenarator.Text & 7
            Case 8
                txtgenarator.Text = txtgenarator.Text & 8
            Case 9
                txtgenarator.Text = txtgenarator.Text & 9
            Case 10
                txtgenarator.Text = txtgenarator.Text & 0
        End Select

        key = Int(Rnd() * 10)




        Select Case key
            Case 1
                txtgenarator.Text = txtgenarator.Text & 1
            Case 2
                txtgenarator.Text = txtgenarator.Text & 2
            Case 3
                txtgenarator.Text = txtgenarator.Text & 3
            Case 4
                txtgenarator.Text = txtgenarator.Text & 4
            Case 5
                txtgenarator.Text = txtgenarator.Text & 5
            Case 6
                txtgenarator.Text = txtgenarator.Text & 6
            Case 7
                txtgenarator.Text = txtgenarator.Text & 7
            Case 8
                txtgenarator.Text = txtgenarator.Text & 8
            Case 9
                txtgenarator.Text = txtgenarator.Text & 9
            Case 10
                txtgenarator.Text = txtgenarator.Text & 0
        End Select

        key = Int(Rnd() * 10)




        Select Case key
            Case 1
                txtgenarator.Text = txtgenarator.Text & 1
            Case 2
                txtgenarator.Text = txtgenarator.Text & 2
            Case 3
                txtgenarator.Text = txtgenarator.Text & 3
            Case 4
                txtgenarator.Text = txtgenarator.Text & 4
            Case 5
                txtgenarator.Text = txtgenarator.Text & 5
            Case 6
                txtgenarator.Text = txtgenarator.Text & 6
            Case 7
                txtgenarator.Text = txtgenarator.Text & 7
            Case 8
                txtgenarator.Text = txtgenarator.Text & 8
            Case 9
                txtgenarator.Text = txtgenarator.Text & 9
            Case 10
                txtgenarator.Text = txtgenarator.Text & 0
        End Select

        key = Int(Rnd() * 10)

        txtgenarator.Text = txtgenarator.Text & "-"


        Select Case key
            Case 1
                txtgenarator.Text = txtgenarator.Text & 1
            Case 2
                txtgenarator.Text = txtgenarator.Text & 2
            Case 3
                txtgenarator.Text = txtgenarator.Text & 3
            Case 4
                txtgenarator.Text = txtgenarator.Text & 4
            Case 5
                txtgenarator.Text = txtgenarator.Text & 5
            Case 6
                txtgenarator.Text = txtgenarator.Text & 6
            Case 7
                txtgenarator.Text = txtgenarator.Text & 7
            Case 8
                txtgenarator.Text = txtgenarator.Text & 8
            Case 9
                txtgenarator.Text = txtgenarator.Text & 9
            Case 10
                txtgenarator.Text = txtgenarator.Text & 0
        End Select

        key = Int(Rnd() * 10)




        Select Case key
            Case 1
                txtgenarator.Text = txtgenarator.Text & 1
            Case 2
                txtgenarator.Text = txtgenarator.Text & 2
            Case 3
                txtgenarator.Text = txtgenarator.Text & 3
            Case 4
                txtgenarator.Text = txtgenarator.Text & 4
            Case 5
                txtgenarator.Text = txtgenarator.Text & 5
            Case 6
                txtgenarator.Text = txtgenarator.Text & 6
            Case 7
                txtgenarator.Text = txtgenarator.Text & 7
            Case 8
                txtgenarator.Text = txtgenarator.Text & 8
            Case 9
                txtgenarator.Text = txtgenarator.Text & 9
            Case 10
                txtgenarator.Text = txtgenarator.Text & 0
        End Select

        key = Int(Rnd() * 10)




        Select Case key
            Case 1
                txtgenarator.Text = txtgenarator.Text & 1
            Case 2
                txtgenarator.Text = txtgenarator.Text & 2
            Case 3
                txtgenarator.Text = txtgenarator.Text & 3
            Case 4
                txtgenarator.Text = txtgenarator.Text & 4
            Case 5
                txtgenarator.Text = txtgenarator.Text & 5
            Case 6
                txtgenarator.Text = txtgenarator.Text & 6
            Case 7
                txtgenarator.Text = txtgenarator.Text & 7
            Case 8
                txtgenarator.Text = txtgenarator.Text & 8
            Case 9
                txtgenarator.Text = txtgenarator.Text & 9
            Case 10
                txtgenarator.Text = txtgenarator.Text & 0
        End Select

        key = Int(Rnd() * 10)




        Select Case key
            Case 1
                txtgenarator.Text = txtgenarator.Text & 1
            Case 2
                txtgenarator.Text = txtgenarator.Text & 2
            Case 3
                txtgenarator.Text = txtgenarator.Text & 3
            Case 4
                txtgenarator.Text = txtgenarator.Text & 4
            Case 5
                txtgenarator.Text = txtgenarator.Text & 5
            Case 6
                txtgenarator.Text = txtgenarator.Text & 6
            Case 7
                txtgenarator.Text = txtgenarator.Text & 7
            Case 8
                txtgenarator.Text = txtgenarator.Text & 8
            Case 9
                txtgenarator.Text = txtgenarator.Text & 9
            Case 10
                txtgenarator.Text = txtgenarator.Text & 0
        End Select

        key = Int(Rnd() * 10)
        txtgenarator.Text = txtgenarator.Text & "-"



        Select Case key
            Case 1
                txtgenarator.Text = txtgenarator.Text & 1
            Case 2
                txtgenarator.Text = txtgenarator.Text & 2
            Case 3
                txtgenarator.Text = txtgenarator.Text & 3
            Case 4
                txtgenarator.Text = txtgenarator.Text & 4
            Case 5
                txtgenarator.Text = txtgenarator.Text & 5
            Case 6
                txtgenarator.Text = txtgenarator.Text & 6
            Case 7
                txtgenarator.Text = txtgenarator.Text & 7
            Case 8
                txtgenarator.Text = txtgenarator.Text & 8
            Case 9
                txtgenarator.Text = txtgenarator.Text & 9
            Case 10
                txtgenarator.Text = txtgenarator.Text & 0
        End Select

        key = Int(Rnd() * 10)




        Select Case key
            Case 1
                txtgenarator.Text = txtgenarator.Text & 1
            Case 2
                txtgenarator.Text = txtgenarator.Text & 2
            Case 3
                txtgenarator.Text = txtgenarator.Text & 3
            Case 4
                txtgenarator.Text = txtgenarator.Text & 4
            Case 5
                txtgenarator.Text = txtgenarator.Text & 5
            Case 6
                txtgenarator.Text = txtgenarator.Text & 6
            Case 7
                txtgenarator.Text = txtgenarator.Text & 7
            Case 8
                txtgenarator.Text = txtgenarator.Text & 8
            Case 9
                txtgenarator.Text = txtgenarator.Text & 9
            Case 10
                txtgenarator.Text = txtgenarator.Text & 0
        End Select

        key = Int(Rnd() * 10)




        Select Case key
            Case 1
                txtgenarator.Text = txtgenarator.Text & 1
            Case 2
                txtgenarator.Text = txtgenarator.Text & 2
            Case 3
                txtgenarator.Text = txtgenarator.Text & 3
            Case 4
                txtgenarator.Text = txtgenarator.Text & 4
            Case 5
                txtgenarator.Text = txtgenarator.Text & 5
            Case 6
                txtgenarator.Text = txtgenarator.Text & 6
            Case 7
                txtgenarator.Text = txtgenarator.Text & 7
            Case 8
                txtgenarator.Text = txtgenarator.Text & 8
            Case 9
                txtgenarator.Text = txtgenarator.Text & 9
            Case 10
                txtgenarator.Text = txtgenarator.Text & 0
        End Select

        key = Int(Rnd() * 10)




        Select Case key
            Case 1
                txtgenarator.Text = txtgenarator.Text & 1
            Case 2
                txtgenarator.Text = txtgenarator.Text & 2
            Case 3
                txtgenarator.Text = txtgenarator.Text & 3
            Case 4
                txtgenarator.Text = txtgenarator.Text & 4
            Case 5
                txtgenarator.Text = txtgenarator.Text & 5
            Case 6
                txtgenarator.Text = txtgenarator.Text & 6
            Case 7
                txtgenarator.Text = txtgenarator.Text & 7
            Case 8
                txtgenarator.Text = txtgenarator.Text & 8
            Case 9
                txtgenarator.Text = txtgenarator.Text & 9
            Case 10
                txtgenarator.Text = txtgenarator.Text & 0
        End Select

        key = Int(Rnd() * 10)

        txtgenarator.Text = txtgenarator.Text & "-"


        Select Case key
            Case 1
                txtgenarator.Text = txtgenarator.Text & 1
            Case 2
                txtgenarator.Text = txtgenarator.Text & 2
            Case 3
                txtgenarator.Text = txtgenarator.Text & 3
            Case 4
                txtgenarator.Text = txtgenarator.Text & 4
            Case 5
                txtgenarator.Text = txtgenarator.Text & 5
            Case 6
                txtgenarator.Text = txtgenarator.Text & 6
            Case 7
                txtgenarator.Text = txtgenarator.Text & 7
            Case 8
                txtgenarator.Text = txtgenarator.Text & 8
            Case 9
                txtgenarator.Text = txtgenarator.Text & 9
            Case 10
                txtgenarator.Text = txtgenarator.Text & 0
        End Select

        key = Int(Rnd() * 10)




        Select Case key
            Case 1
                txtgenarator.Text = txtgenarator.Text & 1
            Case 2
                txtgenarator.Text = txtgenarator.Text & 2
            Case 3
                txtgenarator.Text = txtgenarator.Text & 3
            Case 4
                txtgenarator.Text = txtgenarator.Text & 4
            Case 5
                txtgenarator.Text = txtgenarator.Text & 5
            Case 6
                txtgenarator.Text = txtgenarator.Text & 6
            Case 7
                txtgenarator.Text = txtgenarator.Text & 7
            Case 8
                txtgenarator.Text = txtgenarator.Text & 8
            Case 9
                txtgenarator.Text = txtgenarator.Text & 9
            Case 10
                txtgenarator.Text = txtgenarator.Text & 0
        End Select

        key = Int(Rnd() * 10)




        Select Case key
            Case 1
                txtgenarator.Text = txtgenarator.Text & 1
            Case 2
                txtgenarator.Text = txtgenarator.Text & 2
            Case 3
                txtgenarator.Text = txtgenarator.Text & 3
            Case 4
                txtgenarator.Text = txtgenarator.Text & 4
            Case 5
                txtgenarator.Text = txtgenarator.Text & 5
            Case 6
                txtgenarator.Text = txtgenarator.Text & 6
            Case 7
                txtgenarator.Text = txtgenarator.Text & 7
            Case 8
                txtgenarator.Text = txtgenarator.Text & 8
            Case 9
                txtgenarator.Text = txtgenarator.Text & 9
            Case 10
                txtgenarator.Text = txtgenarator.Text & 0
        End Select

        key = Int(Rnd() * 10)




        Select Case key
            Case 1
                txtgenarator.Text = txtgenarator.Text & 1
            Case 2
                txtgenarator.Text = txtgenarator.Text & 2
            Case 3
                txtgenarator.Text = txtgenarator.Text & 3
            Case 4
                txtgenarator.Text = txtgenarator.Text & 4
            Case 5
                txtgenarator.Text = txtgenarator.Text & 5
            Case 6
                txtgenarator.Text = txtgenarator.Text & 6
            Case 7
                txtgenarator.Text = txtgenarator.Text & 7
            Case 8
                txtgenarator.Text = txtgenarator.Text & 8
            Case 9
                txtgenarator.Text = txtgenarator.Text & 9
            Case 10
                txtgenarator.Text = txtgenarator.Text & 0
        End Select






    End Sub
End Class


     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend