Windows Develop Bookmark and Share   
 index > Windows Forms General > check to see if folder exists
 

check to see if folder exists

I have a windows forms application and i need to check to see if a folder exists and if not then i need to create that folder, what is the sytax for this? anyone have any code samples?

I'm using vb.net 2005. thanks

DaveTrout  Tuesday, May 13, 2008 5:21 PM

In C#

using System.IO

Code Snippet

if (!Directory.Exists(@"C:\JohnsFolder"))

Directory.CreateDirectory(@"C:\JohnsFolder");

in VB.NET

Imports System.IO

Code Snippet

If Not Directory.Exists("C:\JohnsFolder")

Directory.CreateDirectory("C:\JohnsFolder")

End If

JohnGrove  Tuesday, May 13, 2008 6:00 PM

In C#

using System.IO

Code Snippet

if (!Directory.Exists(@"C:\JohnsFolder"))

Directory.CreateDirectory(@"C:\JohnsFolder");

in VB.NET

Imports System.IO

Code Snippet

If Not Directory.Exists("C:\JohnsFolder")

Directory.CreateDirectory("C:\JohnsFolder")

End If

JohnGrove  Tuesday, May 13, 2008 6:00 PM

You can use google to search for other answers

Custom Search

More Threads

• A global event in a windows form
• Intercepting Form Show method
• Open file control not dialog
• Rebar and Band controls ported to .NET
• Error: Invoke or BeginInvoke cannot be called on a control until the window handle has been created.
• How to develope .exe for winPE???
• DefaultValuesNeeded Event not Firing
• cursor for loading
• Running application in new process
• RichTextBox formatting issues