Connection Test

Hi, im very new to Visual Basic 2005 Express Edition. I have had a bit of past PHP codeing but not alot. I was wondering what i code i could insert into my applictation so that if it does not connect to a webpage, any webpage that it will display a message... "Internet Conection Unavaiable"  Then close the program

 

 

Any help would be great thanks........



Answer this question

Connection Test

  • Cragman

    Hi shak,

    Yes, you can catch an error 404 by using the:r

    WebException Constructor (String, Exception, WebExceptionStatus, WebResponse)

    There is an example in the local help with VB on how to do this.

     

    Hope this helps.

    Matt

     

     


  • Marcos Martins

    Hi, Matt

    yes it was very helpfull, but i have a close question to this, i want to request a page just to see if this page is exist or not, ping method just return if the server available or not but i want to check for particular page like for example http://www.mysite.com/my11thpage.html i want to check if my11thpage.html is exist on www.mysite.com or not longer available or cause request error. is there any idea

    i'll be very thxfull



  • maheer

    Hi,

    Use the My.Computer.Netowrk.Ping Method.

    Example is at:

    http://msdn2.microsoft.com/en-us/library/he5sca5t.aspx

     

    Hope this helps.

    Matt


  • Dmitry-Khmel

    hi, Matt

    yes my friend it helped alot many thx



  • tomazos

    ok, i see what you are saying and that worked great thanks.... but not one other question. How can i make it so once the main app loads up it will ping, and tell the user if it was sucessful

     

    I looked for an on load command but could not find it......


  • Priyananth

    awesome thanks alot.......
  • GhansonNCR

    Hi,

    Glad that worked.

    Put it in the Form Load Event, and use a msgbox or any method you like to tell your user wheather it worked or not.  Double click on Form1 in designer to get to your form1 load event.

    Hope this helps.

    Matt


  • Connection Test