473,386 Members | 1,758 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

create a folder useing vb code?

How can i create a folder using vb.net code?

Thanks

Aug 16 '06 #1
4 27954
take a look a system.io

specifically system.io.directory

<zo****@yahoo.comwrote in message
news:11**********************@h48g2000cwc.googlegr oups.com...
How can i create a folder using vb.net code?

Thanks

Aug 16 '06 #2
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

zo****@yahoo.com wrote:
How can i create a folder using vb.net code?

Thanks
Aug 17 '06 #3
Hello Tips,

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

System.IO.Directory.CreateDirectory("C:\MyDirector y")

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
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
zo****@yahoo.com wrote:
>How can i create a folder using vb.net code?

Thanks

Aug 17 '06 #4
Hello Cyril,

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

Regards
Elnahrawi

Cyril Gupta wrote:
Hello Tips,

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

System.IO.Directory.CreateDirectory("C:\MyDirector y")

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
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
zo****@yahoo.com wrote:
How can i create a folder using vb.net code?

Thanks
Aug 17 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Ken Fine | last post by:
I want my application to maintain a directory tree based on months and years, e.g.: 2004 January file file file February file
4
by: Jerry | last post by:
I am trying to create a contact using CDO 1.21. I was wondering if anyone had any sample code of how they may have done this. I am having trouble findinf documentation on how this is done. I...
3
by: Kent | last post by:
I am try to link a SQL 2000 table to Access 2000 using VB.Net 2003 Here is my code: Dim Con As New ADODB.Connection Dim Cat As New ADOX.Catalog Dim tbl As New ADOX.Table ...
3
by: Amjad | last post by:
Hi, I just wrote a test Windows Service that creates a text file on startup (please see my code below). The file is never created. Protected Overrides Sub OnStart(ByVal args() As String) Dim...
8
by: Paw | last post by:
Greetings. I use asp. what I need is is when a visitor comes to the site, I need it to check the host name. if "www.hometowndigest.com" is the host, then check a folder named "something" and if...
0
by: 1333 | last post by:
I need to create a new folder every time the upload folder has 10 files uploaded to it. So when folder1 has 10 files, folder2 is created and becomes the upload folder, and when it has 10 files...
4
by: Alan Mailer | last post by:
Again, I'm new to VB.net and there is something I need help with: Like (I assume) many of us, over time I want to be able to create some VB.net classes that I might want to use in more than one...
0
by: beary | last post by:
Hi, How do I set up the .htaccess file to protect the root folder, but to have a subfolder which is *not* protected? Thanks
5
by: krasman | last post by:
hi everyone, i hope you might help me on this one. i need to create a contact in a exchange public folder using dotnet (vb or c#) and exchange 2003, without using outlook object model. i'm...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.