To create a folder in C# and VB.NET you can use the following snippet.

Sample C#

try
{
	const string path = @"C:\Users\Codesnippets\Desktop\Testfolder\Test1\Test2";
	Directory.CreateDirectory(path);
}
catch (Exception ex)
{
	//handle the exception your way
}

Sample VB.NET

Try
	Const  path As String = "C:\Users\Codesnippets\Desktop\Testfolder\Test1\Test2"
	Directory.CreateDirectory(path)
Catch ex As Exception
        'handle the exception your way
End Try

One thought on “How to create a folder in C# and VB.NET”

Leave a Reply