Login or Sign Up to become a member!
LessThanDot Sit Logo

LessThanDot

Community Wiki

Less Than Dot is a community of passionate IT professionals and enthusiasts dedicated to sharing technical knowledge, experience, and assistance. Inside you will find reference materials, interesting technical discussions, and expert tips and commentary. Once you register for an account you will have immediate access to the forums and all past articles and commentaries.

LTD Social Sitings

Lessthandot twitter Lessthandot Linkedin Lessthandot friendfeed Lessthandot facebook Lessthandot rss

Note: Watch for social icons on posts by your favorite authors to follow their postings on these and other social sites.

Navigation

Google Ads

VB.Net: Deleting a directory

From Wiki

Jump to: navigation, search

Very simple when using the system.io namespace.

Do use a try catch block because this thing can backfire and it will.

  1. Imports System.IO
  2.  
  3. Module Module1
  4.  
  5.     Sub Main()
  6.         Try
  7.             Directory.Delete("c:\temp")
  8.         Catch ex As Exception
  9.             Console.WriteLine("The directory could not be deleted for the following reason:" & ex.Message)
  10.         End Try
  11.     End Sub
  12.  
  13. End Module

509 Rating: 1.3/5 (3 votes cast)