HOW TO CREATE DIRECTORY IN VB.NET

HOW TO CREATE DIRECTORY IN VB.NET
=====================================================================================
Imports System.io
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim objDir As New DirectoryInfo("c:\TestDir")
Try
objDir.Create()
Try
objDir.CreateSubdirectory("TestSubDir") 'name for new subdirectory

Catch
Throw New Exception("Failed to create new subdirectory")
End Try

Catch
Throw New Exception("Failed to create new directory")
End Try


End Sub

No comments: