Link to home
Avatar of JB493
JB493

asked on

The file is in use by another process after reading a directory

I am using the following code to find files in a directory and attach them to an email. It finds the file and attaches them as it is supposed to. when I try to then move them to a history folder I get the message "the file is in use by another process."  I have tried everything I can think of to release the resources but it doesn't seem to help.

For Each foundFile As String In My.Computer.FileSystem.GetFiles _
(My.Computer.FileSystem.SpecialDirectories.MyDocuments)
  Next
ASKER CERTIFIED SOLUTION
Avatar of Mike Tomlinson
Mike Tomlinson
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial