Hey guys, I haven't been on here in a while I have been busy with a bunch of things. Anywho, I would like to create a program that will ping a bunch of ip's with a single click and then if the IP is alive I would like my label to light up green if it's dead to light up red.
This is the code I have so far.
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim MyPing As New System.Net.NetworkInformation.Ping
Dim MyPingResult As System.Net.NetworkInformation.PingReply = MyPing.Send("www.google.com")
If MyPingResult.Status = Net.NetworkInformation.IPStatus.Success Then
MessageBox.Show("Status: " & MyPingResult.Status.ToString)
Else
MessageBox.Show(MyPingResult.Status.ToString)
End If
End Sub
So basically when I run the program the way it is right now, it replies back "success", which is what is suppose to happen. What I would like to happen is.
When I click on the ping button each label would have an IP address associated with it and if it pings successfully I would like the
label(s), "Location 1" to light up green, if it fails I would like for it to light up red. And when you put the mouse over a label ("Location 1") I would like a window to pop up or fade in showing the IP address of that Location.
Any help, suggestion, comments, are appreciated.
Thanks for taking the time out to read my thread, hopefully this will help others.
you could add next to the messagebox.show label.forecolor = color.what ever
you could add tool tips and if conditions to set the tooltiptext to show the IP address or what ever you want
I have recently done a ping program it is not exactly what you are doing but it may help you along a little bit. I have attached the exe to this post but here is some sample code:
VB Code:
Dim MyPing As New System.Net.NetworkInformation.Ping
Dim MyPingResult As System.Net.NetworkInformation.PingReply = MyPing.Send(pcname)
Attachments
Most of the forums will allow you to add an attachment. Just because you can, doesn't mean you should. If you are going to include an attachment to your post consider the following:
>Do you really need an attachement? If providing the attachment doesn't add to your question, then don't include it. Most people won't look at an attchment. If your attachment is a short code listing, then you are better to include the code (or a snippet of your code) in your message rather than as an attached file.
>What files do you really need to attach? Granted, it is a zip file that you will most likely attach; however, what files do you really need to include? In most cases, you will only need the .h and .cpp files for C++ and VC++ files. In VB you will only need the forms and coding files. If there are files that are not needed, then don't include them.
>Many people use dial-up. Larger attachements will be avoided because they take too long to download. In general, you should try to keep your attachments under 100k.
Nothing about EXE's and mine is a zip! Anyway off topic so that's all you will here from me sorry if it is a rule that I have skipped over.
In VB you will only need the forms and coding files. If there are files that are not needed, then don't include them.
I guess it depends on how you interpret it.
I'm very aware that yours is a zip file. I can read. But going beyond the obvious it contains an executable which isn't a good idea.
Imagine a bunch of dodgy hacker type people began posting zip files with dodgy .exe files onto the forum saying "check this program out" ... well, you can imagine the implications.
It's for the safety of everyone that only code/forms are included which goes beyond topic relevance. It's to do with this thread so very much still on topic.
p.s. I'm not in any way saying you are a "dodgy hacker type".
Last edited by stimbo; Jan 29th, 2007 at 09:12 AM.
That's it I am sueing you for calling me that, lol.
Yes I do understand where you are coming from it is always a possability and a risk however,
Firstly I am not telling people to try this amazing program or anything.
Secondly Encase of an infection I scan all files before I upload them and people on the internet should have Anti-virus scanners with real time protection to and I advise to scan all downloaded files anyway that will tell you whether it is dodgy or not and before you say if its a brand new virus it won't if you get something good like Kaspersky it will stop things that its never heard before.
Thirdly, If you put my name in a search on this forum you will see that I am a normal member.
Fourthly, (although you don't know this and have no proof) I think that anyone who thinks that viruses or any sort of software to ruin, steal information are really sad. They have nothing better to do so they result to the lowest of activites. My honest opin I think all people like that should be tied up and let a computer slowly pick/pull and cut bits of the skin/body away resulting in a cruel death. lol. Anyway better get back to work
It could be a well meaning newbie with the best intentions in the world causing havoc. Again, just speaking generally here.
would your antivirus pick that up?? Imagine what it could do with some simple everyday system commands. Moving folders, changing settings. It doesn't have to be a virus to cause trouble.
You can't say everyone should have anti-virus either - we all know that people don't or they don't keep them up to date.
What about encryption and your My Documents folder for example.
I didn't mean for this to become a lengthy debate, was just a heads up on the possible disadvantage of ANYONE posting an exe when the form would do. The risks increase, that's all. I would feel more comfortable looking at form code first and satisfying myself that it's fine before compiling.
Last edited by stimbo; Jan 29th, 2007 at 09:47 AM.