Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27554

Error When Run not When Single Step

$
0
0
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?

Viewing all articles
Browse latest Browse all 27554

Trending Articles