Solved

Visual Studio 2008 - create directory if does not exist

Posted on 2011-09-21
4
209 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 400 total points
Comment Utility
If Not Directory.Exists(path) Then
    Directory.CreateDirectory(path)
End If
0
 
LVL 25

Assisted Solution

by:Luis Pérez
Luis Pérez earned 100 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now