472,334 Members | 2,602 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,334 software developers and data experts.

How can I check internet connection in vb

Hi all,
I am writing a program with vb.net which getting some information from
internet. I must check internet connection before some prosess.
But how?
Jul 19 '05 #1
2 25105
The WebRequest class throws a WebException when errors occur while accessing
an Internet resource, so just try to connect and trap any erro that arises.

--
Regards

John Timney (Microsoft ASP.NET MVP)
----------------------------------------------
<shameless_author_plug>
Professional .NET for Java Developers with C#
ISBN:1-861007-91-4
Professional Windows Forms
ISBN: 1861005547
Professional JSP 2nd Edition
ISBN: 1861004958
Professional JSP
ISBN: 1861003625
Beginning JSP Web Development
ISBN: 1861002092
</shameless_author_plug>
----------------------------------------------

"Kadir CAMOGLU" <ka******@hotmail.com> wrote in message
news:uK**************@tk2msftngp13.phx.gbl...
Hi all,
I am writing a program with vb.net which getting some information from
internet. I must check internet connection before some prosess.
But how?

Jul 19 '05 #2
just call above ftn which returns true or false


--------*********--------
Private Function IsConnectionAvailable() As Boolean
'Call url
Dim url As New System.Uri("http://www.google.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
May 31 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Matt Hawley | last post by:
I'm facing a problem where I need to verify that my windows forms application has access to the internet before it can do anything. Currently, the...
0
by: sleepyant | last post by:
Hi, how can I check the internet connection and pop-up a Dial-Up Networking dialog when there isn't any? I've tried the following: Dim myReq...
9
by: sleepyant | last post by:
Hi, I've posted this question on several forum but have no response. So I hope anyone who have any idea what I'm talking about please give your...
8
by: Jozef | last post by:
Hello, Is there a way to test that an internet connection exists and that you are able to see the webserver before performing any connections? ...
3
by: Jonny | last post by:
Hi, Please could you tell me how to check for an internet connection in C. I'm using Windows 2000. Many Thanks, Jonny
2
by: Ron Vecchi | last post by:
I have an aplication that will consitently be comutication with a webserver remotly via Internet. What is the best way and most lightweight way to...
1
by: Kadir CAMOGLU | last post by:
Hi all, I am writing a program with vb.net which getting some information from internet. I must check internet connection before some prosess. But...
8
by: Nikola Bucic | last post by:
Could someone tell me how can I constantly check if I'm connected to internet and if possible to determine what type of connection is it. My best...
4
by: Goldwind | last post by:
Hi, From a desktop application, i want to check if an internet connection exist. Many articles use the win api "InternetGetConnectedState", but...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
0
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.