Getox Posted January 2, 2005 Posted January 2, 2005 (edited) Im making a program that downloads images, but if the image didnt exist IE 404 Error, how would i stop the program from crashing and saying [ Continue | Exit ] ? oh btw this is my code: Dim File1 As String = site.Text & "/dir1/test.gif" wclient.DownloadFile(File1, save.Text & "\dir1\test.gif") but if that file dont exist, it does 404 and then my program crashed and asks to continue or exit.. please help. Edited January 2, 2005 by Getox Quote Page Edit 2.0 Alpha 2 OUT NOW! - Download Now -
coldfusion244 Posted January 2, 2005 Posted January 2, 2005 Im making a program that downloads images' date=' but if the image didnt exist IE 404 Error, how would i stop the program from crashing and saying [ Continue | Exit '] ? oh btw this is my code: Dim File1 As String = site.Text & "/dir1/test.gif" wclient.DownloadFile(File1, save.Text & "\dir1\test.gif") but if that file dont exist, it does 404 and then my program crashed and asks to continue or exit.. please help. Why not use a Try/Catch statement...http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vblr7/html/vastmtrycatchfinally.asp Quote -Sean
Getox Posted January 2, 2005 Author Posted January 2, 2005 i dont want it to take me to the image i just want to know how to stop the program from crashing. Quote Page Edit 2.0 Alpha 2 OUT NOW! - Download Now -
Administrators PlausiblyDamp Posted January 2, 2005 Administrators Posted January 2, 2005 Is there any reason why using a Try ... Catch wouldn't work? It will allow you to handle the error however you see fit. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Getox Posted January 2, 2005 Author Posted January 2, 2005 but how do i make it not crash on 404 error? what do i have to do? Quote Page Edit 2.0 Alpha 2 OUT NOW! - Download Now -
Administrators PlausiblyDamp Posted January 2, 2005 Administrators Posted January 2, 2005 Just wrap the call to the .DownloadFile method within a try ... catch block, did you even read the link coldfusion posted? Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Getox Posted January 2, 2005 Author Posted January 2, 2005 Ooh i see now, Thanks heaps for that.. Quote Page Edit 2.0 Alpha 2 OUT NOW! - Download Now -
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.