Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 247
  • Last Modified:

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?
0
dastaub
Asked:
dastaub
  • 2
2 Solutions
 
QPRCommented:
If Not Directory.Exists(path) Then
    Directory.CreateDirectory(path)
End If
0
 
Luis PérezSoftware 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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now