?
Solved

Visual Studio 2008 - create directory if does not exist

Posted on 2011-09-21
4
Medium Priority
?
222 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses

762 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