Help with this code!!!

Status
Not open for further replies.

xAlphaPlayerx

Senior
Original poster
senior
member
Joined
Jul 27, 2011
Posts
1,206
Reaction score
147
Points
46
Location
Karkand
I'm making a simple keygen in VB2010 (random keys, with no program or game objective) and i got a problem.

It have two Tabs, both have a TextBox and two buttons: Generate and Save Keys. The first tab is a Single Key generator, a non-multiline textbox, and the second should generate 1000 keys, one key per line. The problem is that i don't know how to set the 1000 keys number. With a list it would be easy:


Dim a As String
While ListBox1.Items.Count < 1000

code

End While
End Sub


But i tryed this for the TextBox:


Dim a As String
TextBox2.Text.Count(1000)

code

End Sub


But it gives me this error:

A type 'Integer' value can't convert into 'System.Func(OfChar, Boolean)'.

How the f*ck can i set 1k keys per line in a TextBox??

Download the code here (Frame Banner Adly + Mediafire) or read it here:

Public Class Form1

'!KeyGen coding!'

'Single KeyGen'
Public Function makepw1() As Object
Dim E, F, G, H, J As Object
E = "1234567890ABCDEFGHIJKLMNOPQRSTUVWXZ"
F = Len(E)
G = 25
Randomize()
H = ""
For intstep = 1 To G
J = Int((F * Rnd()) + 1)
H = H & Mid(E, J, 1)
Next
makepw1 = H
End Function

Public Function makepw2() As Object
Dim E, F, G, H, J As Object
E = "1234567890ABCDEFGHIJKLMNOPQRSTUVWXZ"
F = Len(E)
G = 25
Randomize()
H = ""
For intstep = 1 To G
J = Int((F * Rnd()) + 1)
H = H & Mid(E, J, 1)
Next
makepw2 = H
End Function

'!First TabControl menu //Single Key//!'

'Generate SingleKey button'
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim a As String
a = makepw1()
TextBox1.Text = a

End Sub

'--Generated SingleKey TextBox'
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged

End Sub

'--Save SingleKey button'
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim Save As New SaveFileDialog()
Dim myStreamWriter As System.IO.StreamWriter
Save.Filter = "Text (*.txt)|*.txt"
Save.CheckPathExists = True
Save.Title = "Save Key As"
Save.ShowDialog(Me)
Try
myStreamWriter = System.IO.File.AppendText(Save.FileName)
myStreamWriter.Write(TextBox1.Text)
myStreamWriter.Flush()
Catch ex As Exception

End Try

End Sub

'!Second TabContol menu //Multiple Keys//!'

'--Generate MultipleKeys button'
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim a As String
TextBox2.Text.Count(1000)
a = makepw2()
TextBox2.Text = a
End Sub

'--Save MultipleKeys button'
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Dim Save As New SaveFileDialog()
Dim myStreamWriter As System.IO.StreamWriter
Save.Filter = "Text (*.txt)|*.txt"
Save.CheckPathExists = True
Save.Title = "Save Keys As"
Save.ShowDialog(Me)
Try
myStreamWriter = System.IO.File.AppendText(Save.FileName)
myStreamWriter.Write(TextBox2.Text)
myStreamWriter.Flush()
Catch ex As Exception

End Try

End Sub

Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)

End Sub
End Class

Updateeee

Fck, i've tryed a While Count of 1000, 500, 2 or any number but when i click generate it freezes. Daaamn..

Hope some pro coders help me :)

My head is blowing up. Someone can help me? I just want to add X key number at the same time in a TextBox!!
 

Codez Hybrid

PHP Coder
senior
member
Trade With Caution!
Joined
Dec 29, 2010
Posts
4,756
Reaction score
1,655
Points
89
Location
Indiana, USA
Website
www.offerscript.net
off topic....if your a pro coder you won't be using VB
 
  • Like
Reactions: Raspbooty
S

SL33pErC3LL

Guest
i can help you but i do not understand you when you say you "I dont know how to set the 1000 keys number".
 

bullseye

Veteran
veteran
old school
senior
member
Joined
Dec 9, 2010
Posts
3,563
Reaction score
417
Points
173
Location
The Clouds
ok... what are you having your problems with?
Is it making a code, putting a code per line in a richtextbox, or saving them?
 

spartin

Old School
old school
member
Joined
May 9, 2010
Posts
1,275
Reaction score
59
Points
153
If you know any other language, I would recommend Java, javascript, or and part of the C family for this.

Also, you should use the code quotes so people can look at formatted code.

Another thing, if this is a personal bot utility, there really is no need for a UI.
 
  • Like
Reactions: xAlphaPlayerx
K

KamaluNg

Guest
Here's a simple way to do something like this.

Get a timer. Set its interval to 1.
Get a label set the text to 0.

Code:
Button1 private sub etc....
timer1.start
end sub

timer1_tick etc.....

label1.text = label1.text + 1

if label1.text =< 1000 then
timer1.stop
msgbox("BOT IS DONE")
else
TextBox1.Text = Int(Rnd() * 4)
Select Case TextBox1.Text
Case 0
TextBox1.Text = "CD key"
Case 1
TextBox1.Text = "CD key"
Case 2
TextBox1.Text = "CD key"
Case 3
TextBox1.Text = "CD key"
End Select
end if

Listbox1.items.add(textbox1.text)

end sub

idk just thought of it. should work perfectly
 

xAlphaPlayerx

Senior
Original poster
senior
member
Joined
Jul 27, 2011
Posts
1,206
Reaction score
147
Points
46
Location
Karkand
Well, let's see. I have set a Random function to generate different codes every time the user click the Generate button. Here you got the both codes (one for the Single Key and the other for the Multiple Keys), with the name of setpw1 and setpw2:

'--Single KeyGen Code'
Public Function makepw1() As Object
Dim E, F, G, H, J As Object
E = "1234567890ABCDEFGHIJKLMNOPQRSTUVWXZ"
F = Len(E)
G = 25
Randomize()
H = ""
For intstep = 1 To G
J = Int((F * Rnd()) + 1)
H = H & Mid(E, J, 1)
Next
makepw1 = H
End Function
'--Multiple KeyGen Code'
Public Function makepw2() As Object
Dim E, F, G, H, J As Object
E = "1234567890ABCDEFGHIJKLMNOPQRSTUVWXZ"
F = Len(E)
G = 25
Randomize()
H = ""
For intstep = 1 To G
J = Int((F * Rnd()) + 1)
H = H & Mid(E, J, 1)
Next
makepw2 = H
End Function

I don't want to make a list with the keys i want, cause i want 1000 different keys every time the user click the Generate Multiple Keys button. For the Single Key is easy, just one time:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim a As String
a = makepw1()
TextBox1.Text = a

End Sub


But i don't know how to do it in the MultipleKeys button:

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Dim a As String
a = makepw2()
TextBox1.Text = a
End Sub


I will try the timer that KamaLuNg recommended me. I'll update if i have problems or if it works :)

I can't do it!! Fuuuuuuuuuuuuuuuck!! I need help to do it guys!!
 

Codez Hybrid

PHP Coder
senior
member
Trade With Caution!
Joined
Dec 29, 2010
Posts
4,756
Reaction score
1,655
Points
89
Location
Indiana, USA
Website
www.offerscript.net
use the code bbcode tags to show your code.
 
K

KamaluNg

Guest
If you can do it once with a single key. Make a button that starts a timer then make your program add the key to the listbox instead of the textbox
 
Status
Not open for further replies.