Results 1 to 5 of 5

Thread: Folder

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Nov 2000
    Location
    Dubai
    Posts
    24
    Is it possible to create a folder from vb?
    When the user enters a folder name it must give the message
    "does not exist and create one?"

  2. #2
    Hyperactive Member
    Join Date
    Jul 2002
    Location
    Canada
    Posts
    455
    Hello ajitha again,

    a Folder is a directory. To make a directory use:

    MkDir("c:\YourDirectory")

    Also handy: ChDir, CurDir & RmDir.

    Nice regards,

    Michelle.

  3. #3
    Addicted Member JasonGS's Avatar
    Join Date
    May 2000
    Location
    California
    Posts
    155
    Here is a real basic way...
    Code:
    Dim MyDir As String
    MyDir = "C:\GARBAGE"
    
    If Dir(MyDir, vbDirectory) = "" Then
        If MsgBox(MyDir & " don't exist, create?", vbYesNo + vbQuestion) = vbYes Then MkDir MyDir
    Else
        MsgBox MyDir & " already exists!", vbInformation
    End If

  4. #4
    Guest
    Don't know why, but this is said to be a better and faster way to check if a folder/file exists or not.

    Code:
    Dim MyDir As String
    MyDir = "C:\MyFolder"
    
    If Len(Dir(MyDir, vbDirectory)) = 0 Then
        If MsgBox(MyDir & " don't exist, create?", vbYesNo + vbQuestion) = vbYes Then MkDir MyDir
    Else
        MsgBox MyDir & " already exists!", vbInformation
    End If

  5. #5
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Well Matt, string comparation is slower than returning the size of a string Altough you wont win a **** by displaying a msgbox right after heh . Using Cbool() instead of comparing with 0 would be even faster though, you may win a nanosecond hehe

    [Edited by kedaman on 01-10-2001 at 08:14 AM]
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width