Check Internet Connection *IsAvailable*
Heres your chance to share your own tutorials with the community. Just post them on here. If your lucky they may even be posted on the main site.
6 posts
Page 1 of 1
how to check if you have internet.
you will need one button
once you have 1 button, double click and enter this code:
you will need one button
once you have 1 button, double click and enter this code:
Code: Select all
hope this helped! (someone posted this, i just edited this a bit. this is more useful in webbrowsers than the original code that i received.)If My.Computer.Network.IsAvailable = True Then
MsgBox("Computer is connected.")
If My.Computer.Network.IsAvaliable = False Then
MsgBox("Computer is not connected.")
End If
try this:
OK,
This is what I was tring to do.
OK,
This is what I was tring to do.
Code: Select all
Private Function IsConnectionAvailable() As Boolean
//Call url
//"http://www.MyServer.com"
//"http://XXX.XXX.XXX.XXX:XXXX" Port Numbers can be used
Dim url As New System.Uri("http://www.MyServeraddress_OR_IP:PORT.com/")
//Request for request
Dim req As System.Net.WebRequest
req = System.Net.WebRequest.Create(url)
Dim resp As System.Net.WebResponse
Try
resp = req.GetResponse()
resp.Close()
req = Nothing
Return True
Catch ex As Exception
req = Nothing
Return False
End Try
End Function
If IsConnectionAvailable() = True Then
//Your code to the Add-Ins "NORMAL" load event goes here
else
//The code if for what you want to happen if server is offline.
MsgBox("Sorry! The server is offline right now. Please try back later.")
End IF
Last edited by Scottie1972 on Sat Feb 19, 2011 11:08 pm, edited 1 time in total.
My.Computer.Network.IsAvaliable is not used to detect an internet connection, it just checks the local network interface.
Edit: Scottie's method should work.
Edit: Scottie's method should work.
Last edited by mandai on Sun Feb 20, 2011 2:03 pm, edited 1 time in total.
mandai wrote:That link doesn't work.oh, then i shall delete topic
My.Computer.Network.IsAvaliable is not used to detect an internet connection, it just checks the local network interface.

Ask a moderator or admin but nice tutorial anyways cooll; cooll;
code it wrote:Ask a moderator or admin but nice tutorial anyways cooll; cooll;yeah i did... it would help if you could too

thx!
6 posts
Page 1 of 1
Copyright Information
Copyright © Codenstuff.com 2020 - 2023