Home All Groups Group Topic Archive Search About

create a folder useing vb code?

Author
16 Aug 2006 1:13 PM
zoneal
How can i create a folder using vb.net code?

Thanks

Author
16 Aug 2006 1:18 PM
AMDRIT
take a look a system.io

specifically system.io.directory



<zon***@yahoo.com> wrote in message
Show quoteHide quote
news:1155733991.368836.174160@h48g2000cwc.googlegroups.com...
> How can i create a folder using vb.net code?
>
> Thanks
>
Author
17 Aug 2006 10:19 AM
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

zon***@yahoo.com wrote:
Show quoteHide quote
> How can i create a folder using vb.net code?
>
> Thanks
Author
17 Aug 2006 11:28 AM
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

Show quoteHide quote
> 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
> zon***@yahoo.com wrote:
>
>> How can i create a folder using vb.net code?
>>
>> Thanks
>>
Author
17 Aug 2006 11:45 AM
Tips
Hello Cyril,

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

Regards
Elnahrawi

Cyril Gupta wrote:
Show quoteHide quote
> 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
>
> > 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
> > zon***@yahoo.com wrote:
> >
> >> How can i create a folder using vb.net code?
> >>
> >> Thanks
> >>