Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

.NET 

[Newb] Random generating 'codes' [Newb]

Hey guys,

I just got into VB.net programming and am literally a noob at this right now. How would I make a button that inputs random numbers and letters into a textbox/label? Like, for a keygen for example.

Thanks in advance C: Will thank the member that helped.
If you're trying to make a fake MS point generator, that's pretty fucking stupid.
(Oct 8, 2012 03:54 PM)Percocet Wrote:  If you're trying to make a fake MS point generator, that's pretty fucking stupid.

No, it's a RuneScape PIN generator. It's for my spreading methods.
PHP Code

<?php 
Public Function Keygenerator(ByVal lenght As Integer) As String
  Dim s 
As New System.Text.StringBuilder("")
  
Dim numbers() As Char = "01234567890123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!£$%^&*()_+=-|\¬`,./;'#][<>?:@~}{!£$%^&*()_+=-|\¬`,./;'#][<>?:@~}{".ToCharArray
  
For i As Integer = 1 To lenght

    Dim z 
As Integer = Int(((numbers.Length - 2) - 0 + 1) * Rnd()) + 1
    s
.Append(numbers(z))
  
Next
  
Return s.ToString
    End 
Function 

Param is the length of the key.
(Oct 8, 2012 03:57 PM)tweety Wrote:  
PHP Code

<?php 
Public Function Keygenerator(ByVal lenght As Integer) As String
  Dim s 
As New System.Text.StringBuilder("")
  
Dim numbers() As Char = "01234567890123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!£$%^&*()_+=-|\¬`,./;'#][<>?:@~}{!£$%^&*()_+=-|\¬`,./;'#][<>?:@~}{".ToCharArray
  
For i As Integer = 1 To lenght

    Dim z 
As Integer = Int(((numbers.Length - 2) - 0 + 1) * Rnd()) + 1
    s
.Append(numbers(z))
  
Next
  
Return s.ToString
    End 
Function 

Param is the length of the key.

Could you maybe explain the code to me if it doesn't waste your time? I just don't want to be spoon fed and learn nothing along the way C: Thanks for giving it though C:
(Oct 8, 2012 03:58 PM)Kush Wrote:  Could you maybe explain the code to me if it doesn't waste your time? I just don't want to be spoon fed and learn nothing along the way C: Thanks for giving it though C:

PHP Code

<?php 
Public Function Keygenerator(ByVal lenght As Integer) As String
  Dim s 
As New System.Text.StringBuilder("") '//String builder that will be appending your text
  Dim numbers() As Char = "01234567890123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!£$%^&*()_+=-|\¬`,./;'
#][<>?:@~}{!£$%^&*()_+=-|\¬`,./;'#][<>?:@~}{".ToCharArray '//Characters that you want to be generated. If you want numbers only delete everything apart from numbers
  
For i As Integer = 1 To lenght '//calling a for loop to length to generate a character

    Dim z As Integer = Int(((numbers.Length - 2) - 0 + 1) * Rnd()) + 1 '
//randomizing the character that will be replacted
    
s.Append(numbers(z)) '//appends the single characte
  Next  '
//goes to the next chracater till it meets the length
  
Return s.ToString '//returns the completed string
    End Function 

Learn a lot man. I love people like you.
(Oct 8, 2012 04:05 PM)tweety Wrote:  
PHP Code

<?php 
Public Function Keygenerator(ByVal lenght As Integer) As String
  Dim s 
As New System.Text.StringBuilder("") '//String builder that will be appending your text
  Dim numbers() As Char = "01234567890123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!£$%^&*()_+=-|\¬`,./;'
#][<>?:@~}{!£$%^&*()_+=-|\¬`,./;'#][<>?:@~}{".ToCharArray '//Characters that you want to be generated. If you want numbers only delete everything apart from numbers
  
For i As Integer = 1 To lenght '//calling a for loop to length to generate a character

    Dim z As Integer = Int(((numbers.Length - 2) - 0 + 1) * Rnd()) + 1 '
//randomizing the character that will be replacted
    
s.Append(numbers(z)) '//appends the single characte

  Next  '
//goes to the next chracater till it meets the length
  
Return s.ToString '//returns the completed string
    End Function 

Learn a lot man. I love people like you.
Haha, great thanks man. Appreciate your time.


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Shell] by absojediDec 27, 2020 02:43 PM 3 144 Dec 27, 2020 02:43 PM
Last Post: absojedi
[Java] by .eXeSep 16, 2020 03:39 AM 3 224 Sep 16, 2020 03:39 AM
Last Post: InterestingUser1111
[C#] by PawnhubNov 16, 2019 05:19 PM 20 912 Nov 16, 2019 05:19 PM
Last Post: SIM-4440595