I have seen many tutorials on youtube that shows how to when a button is pressed it randomly goes through the keys that you have already entered. Is there a way so that when you press a button it automatically generates a key in the format ** - **** - *** - **** - ** but the * = a random number? Any help would be appreciated. I am noob so long detailed answers would be very good thanks.
So you just want it to generate random numbers in that format?
Yes, after a button is pressed :)
its fairly hard if you dont know how to make a simple program like a spammer...just saying
Okay I don't know how to do that but I'd love to do this :'(
If you just want it to generate random numbers in that format, this should work.
Code TextBox1.Text = CInt(Int((9999 - 1000 + 1) * Rnd() + 1000)) & "-" & CInt(Int((99 - 100 + 1) * Rnd() + 100)) & "-" & CInt(Int((99 - 10000 + 1) * Rnd() + 10000)) & "-" & CInt(Int((99 - 100 + 1) * Rnd() + 100)) & "-" & CInt(Int((9999 - 1000 + 1) * Rnd() + 1000))
Just generate 4 keys with the lenght you want and then put them into one string. That isn't difficult.
Code namespace hf
{
class Program
{
static void Main(string[] args)
{
System.Random r = new System.Random();
string str = "";
int i;
for (i = 0; i < 4; i++)
str += r.Next(0,10);
str += "-";
for (i = 0; i < 6; i++)
str += r.Next(0,10);
str += "-";
for (i = 0; i < 5; i++)
str += r.Next(0,10);
str += "-";
for (i = 0; i < 6; i++)
str += r.Next(0,10);
str += "-";
for (i = 0; i < 4; i++)
str += r.Next(0,10);
System.Console.WriteLine(str);
}
}
}
This generates Pseudo-Random numbers from [0,9].With the format you specified " 4 digits - 6 digits - 5 digits -6 digits - 4 digits ".After each iteration it adds the "-".
End Result:
Quote:1457-689226-72695-739804-3852
Press any key to continue . . .
(Apr 3, 2011 05:47 AM)Pussy Cat Wrote: If you just want it to generate random numbers in that format, this should work.
Code TextBox1.Text = CInt(Int((9999 - 1000 + 1) * Rnd() + 1000)) & "-" & CInt(Int((99 - 100 + 1) * Rnd() + 100)) & "-" & CInt(Int((99 - 10000 + 1) * Rnd() + 10000)) & "-" & CInt(Int((99 - 100 + 1) * Rnd() + 100)) & "-" & CInt(Int((9999 - 1000 + 1) * Rnd() + 1000))
Thank you very much does that mean when I press Button1 though because thats what I was getting at :) but thanks very much :)
(Apr 3, 2011 05:52 AM)Elfinity Wrote: Code namespace hf
{
class Program
{
static void Main(string[] args)
{
System.Random r = new System.Random();
string str = "";
int i;
for (i = 0; i < 4; i++)
str += r.Next(0,10);
str += "-";
for (i = 0; i < 6; i++)
str += r.Next(0,10);
str += "-";
for (i = 0; i < 5; i++)
str += r.Next(0,10);
str += "-";
for (i = 0; i < 6; i++)
str += r.Next(0,10);
str += "-";
for (i = 0; i < 4; i++)
str += r.Next(0,10);
System.Console.WriteLine(str);
}
}
}
This generates Pseudo-Random numbers from [0,9].With the format you specified " 4 digits - 6 digits - 5 digits -6 digits - 4 digits ".After each iteration it adds the "-".
End Result: Thanks very much im gonna try that :)
(Apr 3, 2011 05:53 AM)P.M.W Wrote: Thank you very much does that mean when I press Button1 though because thats what I was getting at :) but thanks very much :)
Just put the code under a button and add textbox there.
If you want to make an actual keygen, you could read this and then try to make it into a vb.net app. It might be a little over your head though, but if anyone else wants it:
KeyGen tut: http://www.mediafire.com/?bb4aavswbronu1a
Whole book: http://www.mediafire.com/?2om0nufjs27vjlg
BTW: this came from a book from
http://www.goldshare.co.uk
and I re-upped them
(Apr 3, 2011 05:33 AM)P.M.W Wrote: I have seen many tutorials on youtube that shows how to when a button is pressed it randomly goes through the keys that you have already entered. Is there a way so that when you press a button it automatically generates a key in the format ** - - - - * but the = a random number? Any help would be appreciated. I am noob so long detailed answers would be very good thanks.
If you want letters in there too you can use:
Code Public Shared Function GenKey(ByVal length As Integer)
Dim chars, final As New StringBuilder
Dim r As New Random(Guid.NewGuid.GetHashCode)
chars.Append("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789")
For i = 0 To length - 1
final.Append(chars(r.Next(1, chars.Length - 1)))
Next
Return final.ToString
End Function
Sub generateKey()
Dim key As String = ""
For i As Integer = 1 To 4
key += GenKey(4)
Next
TextBox1.Text = key.TrimEnd("-")
End Sub
Just change the lengths to suit you.
thank u guys, im making fake youtube programs with aeonhack's themes , i will make fake windows 7 keys ... Yay
|