Mega Code Archive

 
Categories / VB.Net Tutorial / Collections
 

Delete a directory with exception catch

Imports System.IO Public Class Tester     Public Shared Sub Main              Try             System.IO.Directory.Delete("c:\a")         Catch ex As Exception             Console.WriteLine(ex.ToString)         Finally             Beep()         End Try          End Sub End Class System.IO.IOException: The directory is not empty. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.Directory.DeleteHelper(String fullPath, String userPath, Boolean recursive) at System.IO.Directory.Delete(String fullPath, String userPath, Boolean recursive) at Tester.Main()