Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

How to: Create a Directory in Visual Basic 

Use the CreateDirectory method of the My.Computer.FileSystem object to create directories.

If the directory already exists, no exception is thrown.

To create a directory

  • Use the CreateDirectory method by specifying the full path of the location where the directory should be created. This example creates the directory NewDirectory in C:\Documents and Settings\All Users\Documents.

    My.Computer.FileSystem.CreateDirectory _
    ("C:\Documents and Settings\All Users\Documents\NewDirectory")

Robust Programming

The following conditions may cause an exception:

See Also

Community Additions

© 2015 Microsoft