473,626 Members | 3,231 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

create a folder useing vb code?

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

Thanks

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

specifically system.io.direc tory

<zo****@yahoo.c omwrote in message
news:11******** **************@ h48g2000cwc.goo glegroups.com.. .
How can i create a folder using vb.net code?

Thanks

Aug 16 '06 #2
In VB 2005 using

My.Computer.Fil eSystem.CreateD irectory ("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.co m 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.Direc tory.CreateDire ctory("C:\MyDir ectory")

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.Fil eSystem.CreateD irectory ("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.co m 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.Direc tory.CreateDire ctory("C:\MyDir ectory")

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.Fil eSystem.CreateD irectory ("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.co m 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
3332
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
570
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 would like to avoid useing outlook if possible and write directly to the exchange server if possible. Thanks Jerry.
3
10577
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 Con.Open(m_sAccessDbPath) Cat.ActiveConnection = Con
3
14908
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 swLog As StreamWriter = File.CreateText("C:\myLog.txt") swLog.WriteLine("My Windows Service has just started.") swLog.Close() : swLog.Flush() End Sub
8
2565
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 the folder does not exsist, create folder "www" and then copy folder "temp" and its contents. If the folder "www" is there, look in it, check to see if the files in folder "temp" are in there, if not, copy the files that are not from folder...
0
1372
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 uploaded to it folder3 is created and so on..... Problem is that my code creates all the next folders all at once. I need it to create the next folder when it is required. i.e. when the previous folder has reached 10 files. If anyone can explain...
4
4459
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 Project. So let's say I've created a Folder called "MyVBNet Classes" to hold these general-use VB.Net class files that I will eventually associate with various Projects I create. Now let's imagine I've created a class called "MyClass.vb" that...
0
2683
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
3565
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 searching for a few hours and can't find a clear example on how to do it. i've already seen code blocks using webdav, directory services, but always related with creating active directory users or mail enabling users, not exactly what i'm looking for....
0
8269
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8203
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8711
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8642
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8368
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7203
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6125
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4206
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2630
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.