create a folder useing vb code?


Ad

Advertisements

T

Tips

In VB 2005 using

My.Computer.FileSystem.CreateDirectory ("C:\MYDIR")


In VB.NET
Imports System
Imports System.IO

Dim di As DirectoryInfo = New DirectoryInfo("c:\MyDir")
' Determine whether the directory exists.
If di.Exists Then
' Indicate that it already exists.
msgbox("That path exists already.")
Else
' Try to create the directory.
di.Create()
End If
 
C

Cyril Gupta

Hello Tips,

There's another method that removes the need of declaring a variable.

System.IO.Directory.CreateDirectory("C:\MyDirectory")

This single line will serve your purpose well.

Regards
Cyril Gupta

You can do anything with a little bit of 'magination.
I have been programming so long, that my brain is now soft-ware.
http://www.cyrilgupta.com/blog
 
Ad

Advertisements

T

Tips

Hello Cyril,

Thanks, But i'v declared the "di" variable just to determine whether
the directory exists.

Regards
Elnahrawi
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Create a DB from VB code???? 4
this C# code in VB? 7
VB code formatter 3
VB Coding Standards... 1
VB Coding Standards 3
VB code help 3
Equivalent code in VB for a C# code 2
Using reference in VB 1

Top