error report

leontager

Regular
Joined
Jun 17, 2003
Messages
89
sometimes my ISP dropps the connection. my program creates a stream of a URL and reports back. I would like it to report seomthing else if it was unable to reach the website.

stream = New IO.StreamReader(wc.OpenRead(URL)

what should I add?
 
My guess is that your wc is the Webclient..

This is c#,

try
{
stream = New IO.StreamReader(wc.OpenRead(URL)
}
catch( Exception )
{
MessageBox.Show("You lost your connection");
}

Obviously you don't need to use the messagebox, but can do whatever you wish to do.
 
Back
Top