[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Visual Studio 2008 - create directory if does not exist

Posted on 2011-09-21
4
Medium Priority
?
232 Views
Last Modified: 2012-05-12
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
Comment
Question by:dastaub
  • 2
4 Comments
 
LVL 29

Accepted Solution

by:
QPR earned 1600 total points
ID: 36578267
If Not Directory.Exists(path) Then
    Directory.CreateDirectory(path)
End If
0
 
LVL 25

Assisted Solution

by:Luis Pérez
Luis Pérez earned 400 total points
ID: 36578755
But for the QPR code to work, don't forget to add:

Imports System.IO

Hope that helps.
0
 
LVL 29

Expert Comment

by:QPR
ID: 36578897
True but if they already have code writing to a file then it's a safe assumption they are already importing system.io
0
 

Author Comment

by:dastaub
ID: 36581448
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

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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question