dcsimg
Results 1 to 10 of 10

Thread: [RESOLVED] How to make a key generator

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2011
    Posts
    4

    Resolved [RESOLVED] How to make a key generator

    Hi guys, hopefully i can get some help from here.
    Im new to VB and i just need a special keygen which i dont know if exists yet or not.

    First off i'd like to mention that i dont want to make a keygen that will generate a random key out of keys that i have to manually code in (cases)
    E.G.
    Dim key As Integer
    key = (Rnd() * 2)
    Select Case key
    Case 1
    TextBox1.Text = "Subs key generated nr 1"
    Case 2
    TextBox1.Text = "Subs key generated nr 1"

    I want to know how to make a keygen that will generate a letter/number randomly out some example letters which would need to be defined.
    E.G.
    Random number out of 0-9 (0,1,2,3 etc)
    Random letter from A-Z (A,B,C etc)
    And then obviously display generated key in TextBox.
    Ideally i would like to improve this more but if i could get the basics then i would move on from there, so please, can anyone help me here?

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,335

    Re: How to make a key generator

    Moved From The Codebank (which is for sharing code rather than asking questions )

  3. #3
    Frenzied Member
    Join Date
    Jan 2010
    Location
    Connecticut
    Posts
    1,687

    Re: How to make a key generator

    Welcome to VB Forums!!!

    You can use the Random class and ASCII values. A-Z is 65-92 and 0-9 is 48-57.
    VB6 Library

    If I helped you then please help me and rate my post!
    If you solved your problem, then please mark the post resolved

  4. #4
    Lively Member
    Join Date
    Sep 2009
    Posts
    115

    Re: How to make a key generator

    Will this keygen be used to generate keys for an existing program or are the keys going to be used for your own software?

  5. #5

    Thread Starter
    New Member
    Join Date
    May 2011
    Posts
    4

    Re: How to make a key generator

    Thanks for replies guys!

    @MarMan, could you please give me a code example or where can i learn how to do it, since im sort of new.I don't know how to come up with new codes/solutions but i understand how they work once i see them and editing them is no problem for me , i just cant come up with the line myself

    @wolfpackmars2, Since my idea is sort of unique/strange that no1 in their right minds wouldn't need before, this is why i cant get it from anywhere else.
    I will pm you my idea, but on this thread can anyone paste or link me the code, since i dont know how to random class or ASCII.

  6. #6
    Frenzied Member
    Join Date
    Jan 2010
    Location
    Connecticut
    Posts
    1,687

    Re: How to make a key generator

    Try this and if you get stuck, post what you have done and someone will assist you.
    VB6 Library

    If I helped you then please help me and rate my post!
    If you solved your problem, then please mark the post resolved

  7. #7
    Frenzied Member bmahler's Avatar
    Join Date
    Oct 2005
    Location
    Somewhere just west of the Atlantic
    Posts
    1,568

    Re: How to make a key generator

    I posted this in the codebank a while ago. It should do what you are looking for. Also has the ability to decode the keys generated to your passkey

    http://www.vbforums.com/showthread.php?t=466358
    Boooya
    • Visual Studio 2008 Professional
    • Don't forget to use [CODE]your code here[/CODE] when posting code
    • Don't forget to rate helpful posts!
    • If you're question was answered please mark your thread [Resolved]


    Code Contributions:
    PHP
    PHP Image Gallery v1.0 PHP Image Gallery v2.0
    VB 2005
    Find Computers on a network Simple License Encryption SQL Server Database Access dll Use Reflection to Return Crystal ReportDocument Silently Print PDF Generic Xml Serailizer


    Useful Links: (more to come)
    MSDN (The first and foremost) MSDN Design Guidelines API Reference Inno Setup Compiler Inno Setup Preprocessor ISTool - Fairly easy to use GUI for creating inno setup projects Connection Strings NAnt -Automated Builds Cruise Control .NET - Frontend for automated builds

  8. #8

    Thread Starter
    New Member
    Join Date
    May 2011
    Posts
    4

    Re: How to make a key generator

    actually i found myself a good video where to learn from.
    Youtube vid

  9. #9
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,020

    Re: How to make a key generator

    Quote Originally Posted by poizzz11 View Post
    actually i found myself a good video where to learn from.
    Youtube vid
    Thats actually the worst piece of code I have seen this year.
    Do NOT use that code as an example for anything except for writing awful code.
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  10. #10
    Frenzied Member
    Join Date
    Jan 2010
    Location
    Connecticut
    Posts
    1,687

    Re: How to make a key generator

    Did you even try to use the random class?

    Here's an example right from that link:
    Code:
    Dim bytes1(99), bytes2(99) As Byte 
    Dim rnd1 As New Random()
    Dim rnd2 As New Random()
    
    rnd1.NextBytes(bytes1)
    rnd2.NextBytes(bytes2)
    
    Console.WriteLine("First Series:")
    For ctr As Integer = bytes1.GetLowerBound(0) to bytes1.GetUpperBound(0)
       Console.Write("{0, 5}", bytes1(ctr))
       If (ctr + 1) Mod 10 = 0 Then Console.WriteLine()
    Next 
    Console.WriteLine()
    Console.WriteLine("Second Series:")        
    For ctr As Integer = bytes2.GetLowerBound(0) to bytes2.GetUpperBound(0)
       Console.Write("{0, 5}", bytes2(ctr))
       If (ctr + 1) Mod 10 = 0 Then Console.WriteLine()
    Next
    What's holding you back besides trying to get someone to solve your issue for you?
    VB6 Library

    If I helped you then please help me and rate my post!
    If you solved your problem, then please mark the post resolved

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width