I have this code in an app:-
Try
System.IO.Directory.Delete(DestinationDirectory, True)
' Directory.Delete(DestinationDirectory, True)
Catch ex As Exception
MsgBox("Error while deleting " & DestinationDirectory & " " & Err.Description)
End Try
Try
System.IO.Directory.CreateDirectory(DestinationDirectory)
Catch ex As Exception
MsgBox("Error while making " & DestinationDirectory & " " & Err.Description)
End Try
(I just need to be sure the directory is empty and chose to delete it and recreate it).
When I single step through this it works fine.
When I run it exits having deleted the directory, but not having created it again, and without going into the Exception.
VB.net 2010, Win 7.
I assume it is a timing issue, does anyone have an idea how to fix it?
Try
System.IO.Directory.Delete(DestinationDirectory, True)
' Directory.Delete(DestinationDirectory, True)
Catch ex As Exception
MsgBox("Error while deleting " & DestinationDirectory & " " & Err.Description)
End Try
Try
System.IO.Directory.CreateDirectory(DestinationDirectory)
Catch ex As Exception
MsgBox("Error while making " & DestinationDirectory & " " & Err.Description)
End Try
(I just need to be sure the directory is empty and chose to delete it and recreate it).
When I single step through this it works fine.
When I run it exits having deleted the directory, but not having created it again, and without going into the Exception.
VB.net 2010, Win 7.
I assume it is a timing issue, does anyone have an idea how to fix it?