I wrote myself a little downloading application so that I could easily grab a set of files from my server and put them all onto a new pc with a clean install of Windows, wi
If(Not System.IO.Directory.Exists(YourPath)) Then
System.IO.Directory.CreateDirectory(YourPath)
End If
(imports System.IO)
if Not Directory.Exists(Path) then Directory.CreateDirectory(Path) end if
VB.NET? System.IO.Directory.Exists(string path)
Under System.IO, there is a class called Directory. Do the following:
If Not Directory.Exists(path) Then
Directory.CreateDirectory(path)
End If
It will ensure that the directory is there.
I see how this would work, what would be the process to create a dialog box that allows the user name the folder and place it where you want to.
Cheers
Try the System.IO.DirectoryInfo class.
The sample from MSDN:
Imports System
Imports System.IO
Public Class Test
Public Shared Sub Main()
' Specify the directories you want to manipulate.
Dim di As DirectoryInfo = New DirectoryInfo("c:\MyDir")
Try
' Determine whether the directory exists.
If di.Exists Then
' Indicate that it already exists.
Console.WriteLine("That path exists already.")
Return
End If
' Try to create the directory.
di.Create()
Console.WriteLine("The directory was created successfully.")
' Delete the directory.
di.Delete()
Console.WriteLine("The directory was deleted successfully.")
Catch e As Exception
Console.WriteLine("The process failed: {0}", e.ToString())
End Try
End Sub
End Class