-
Add error responce
I have written the function:
Code:
Public Function getInternetFile(ByVal fileURL As String) As String
Dim webconnect As New Net.WebClient()
Dim readFileURL As New IO.StreamReader(webconnect.OpenRead(fileURL))
Dim fileInternetContents As String = readFileURL.ReadToEnd
readFileURL.Close()
webconnect.Dispose()
Return fileInternetContents
End Function
Which opens and reads in a file on the internet.
How do i add an error message. ie if the function is called but the fileURL value dosent exsist, then I want it to return an error message. At the moment it will just crash if fileURL is invalid!
THanks!
-