Hi,
Could someone please advise me if there is a more efficient way of ensuring a file is successfully copied before displaying a user notification?
[code] If Destination.Exists Then destination.delete
source.CopyFileTo Destination
ExportWindow.close
if Destination.Exists then MainWindow.m.DeliverNotification( MainWindow.CreateMessage3 )
End If[/code]
Thanks.
DaveS
(DaveS)
2
Check for lasterror message… if it is zero, then all is good
THANK YOU.
Code changed as follows.
[code]If Destination.Exists Then destination.delete
source.CopyFileTo Destination
ExportWindow.close
if source.LastErrorCode > 0 then
MsgBox(“File could not be created!”)
else
MainWindow.m.DeliverNotification( MainWindow.CreateMessage3 )
end If[/code]
Use <>
instead of >
. The error code might be a negative number.
Thanks Kem.
Code changed to:
if source.LastErrorCode <> 0 then
So basically, error messages can be positive or negative - but a value of 0 means all is ok?