04 August, 2011

[TUTORIAL] making a simple pinger in VB [TUTORIAL]

Hello, my name is UMAMI and I am new to visual basics, and have not seen too many good tutorials on HF, so I decided to post on how to make a simple VB pinger or dos. this tut WILL include pictures to be more noob friendly!
~~~BLUE WORDS ARE IMPORTANT~~~

Requirements
-any version of VB preferably 2008 + -- http://www.microsoft.com/express/vb/Default.aspx
-at least a little bit of knowledge in coding
-creativity

after you have installed your selected version of visual basics, run it.
once the client has opened, head over to the top left corner where it says file and click "New Project..." and select the settings like so.
and press continue

You should now have a blank formYeye
you can rescale this form to the size you want, but being that it is just a simple program..lets start smallish. On the left side of the Vb client there should be a toolbox filled with tools that you can use. Lets start by finding the TextBox tool (the tools are in alphabetical order). Place the TextBox some where near the top of your form and make it not too big.
Now look on the ToolBox for a tool called Button, it should be near the top of the list. Once you found it, place two buttons onto your form.
single click on Button1 and follow the settings as shown
and do the same to the second button, but name it "Stop".

Now scroll down the ToolBox until you find a tool named Timer and place it to the side of your buttons(the Timer won't be visible once this is all finished). Make sure on the right side that the timers "Enabled" is False, and to set the Interval to 250.

HERE COMES THE ACTUAL CODING PART!
double click on all of the tools on the form, including the time which is at the bottom below the form, and make the code look exactly like this

if you would like to just copy and paste the whole code here it is
Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Timer1.Enabled = True
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Timer1.Enabled = False
End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Shell("Ping " + (TextBox1.Text) + "-1" + "65000"))
End Sub

Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged

End Sub
End Class

I'll add a second spoiler with the same code to explain each bit!
Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Timer1.Enabled = True //when the start button is clicked, the timer activates causing the ping.
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Timer1.Enabled = False //stops the timer thus stopping the ping
End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Shell("Ping " + (TextBox1.Text) + "-1" + "65000")) //sends ping to the IP you enter into the TextBox
End Sub

Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged

End Sub
End Class

TO finish up you can test your new application by pressing F5, customize it a bit, or save and exit VB and enjoy your new but SIMPLE pinger

Labels:

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home