I have a loop to create same file name with different contents then sending out to a bunch of receivers. I have code like this (both NewCopy/FileToCopy are string variables and stores the path of the file)
If System.IO.File.Exists(NewCopy) = True Then
System.IO.File.Delete(NewCopy) 'Delete existing
System.IO.File.Copy(FileToCopy, NewCopy, True)
When I run the code, first email sent out just fine but when it comes to the next, above error throws out, anyone have any suggestions how do i take care of this issue? I tried googled a bit, looks like it is not disposed properly, but how should i do that? there's no IO.File.Dispose?