T Ted Fines Member Licensed User Nov 5, 2019 #1 All of the examples of File.Copy I've seen don't check for a result code, to see if it actually worked. Is something like the following valid? Or do you always embed it in a Try..Catch? Or is there something like $? that can be evaluated? If File.Copy(a,b,c,d) = True then ' successful action else ' failure action end if
All of the examples of File.Copy I've seen don't check for a result code, to see if it actually worked. Is something like the following valid? Or do you always embed it in a Try..Catch? Or is there something like $? that can be evaluated? If File.Copy(a,b,c,d) = True then ' successful action else ' failure action end if
LucaMs Expert Licensed User Longtime User Nov 5, 2019 #2 File.Copy is not a function, it is a method. You can, as you wrote, use the Try-Catch block or check if File.Exists. File.Copy(a,b,c,d) If File.Exists(c, d) Then Upvote 0
File.Copy is not a function, it is a method. You can, as you wrote, use the Try-Catch block or check if File.Exists. File.Copy(a,b,c,d) If File.Exists(c, d) Then
Erel B4X founder Staff member Licensed User Longtime User Nov 5, 2019 #3 File.Copy is unlikely to fail if the source file exists. If you think that it might fail then you should catch the error with Try / Catch. It shouldn't be possible that File.Copy will not throw an exception and the target file will not exist. You don't need to check it. Upvote 0
File.Copy is unlikely to fail if the source file exists. If you think that it might fail then you should catch the error with Try / Catch. It shouldn't be possible that File.Copy will not throw an exception and the target file will not exist. You don't need to check it.