Visual Studio 2008 - create directory if does not exist

The project is written in Visual Basic 2008.  I have code that writes a text file to c:\TempStorage
What code would be needed to verify the c:\TempStorage directory exists, and if it does not exist, what code would be needed to create the folder c:\tempStorage?
dastaubAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
QPRConnect With a Mentor Commented:
If Not Directory.Exists(path) Then
    Directory.CreateDirectory(path)
End If
0
 
Luis PérezConnect With a Mentor Software Architect in .NetCommented:
But for the QPR code to work, don't forget to add:

Imports System.IO

Hope that helps.
0
 
QPRCommented:
True but if they already have code writing to a file then it's a safe assumption they are already importing system.io
0
 
dastaubAuthor Commented:
I was actually using:
myXML.Save("c:\EPDEHRS\XML\PQRI_" & txtNumber.Text & ".xml")
so
the data of adding "Imports System.IO" was also of value

0
All Courses

From novice to tech pro — start learning today.