Create Sub Directory Using VB.NET

In this article I describe how to create sub-directory using VB.NET.
  • 4254

The Directory.CreateDirectory is also used to create a sub directory. All you have to do is to specify the path of the directory in which this subdirectory will be created in.

The following code snippet creates a Mahesh subdirectory in C:\Temp directory.

Imports System.IO

Module Module1

    Sub Main()

        Dim root As String = "C:\Temp"

        Dim subdir As String = "C:\Temp\Mahesh"

        'If directory does not exist, create it.

        If Not Directory.Exists(root) Then


        End If

        ' Create sub directory

        If Not Directory.Exists(subdir) Then


        End If

    End Sub

End Module


 create SubDirectory in vb.jpg


More Articles

© 2020 DotNetHeaven. All rights reserved.