Results 1 to 3 of 3

Thread: RmDir function doesn't work in LOOP! [simple help]

  1. #1

    Thread Starter
    Registered User
    Join Date
    Mar 2005
    Posts
    66

    Angry RmDir function doesn't work in LOOP! [simple help]

    why doesn't this work?

    Code:
    Private Sub Command1_Click()
    Dim a
    Dim b
    b = InputBox("Enter your name")
    For i = 1 To 50
     a = "c:/windows/desktop/" & b & i
     MkDir a
    Next i
    End Sub
    
    Private Sub Command2_Click()
    Dim a, b
    b = InputBox("Enter ur name")
    For i = 1 To 50
        a = "c:/windows/desktop/" & b & 1 & "/"
        RmDir a
    Next i
    End Sub

  2. #2
    Hyperactive Member Trojan's Avatar
    Join Date
    Dec 2003
    Location
    Area 51
    Posts
    280

    Re: RmDir function doesn't work in LOOP! [simple help]

    Thats Easy!

    Look at your code:

    VB Code:
    1. For i = 1 To 50
    2.     a = "c:/windows/desktop/" & b & [B]1[/B] & "/"
    3.     RmDir a
    4. Next i

    can't delete same folder twice!

    sould be:

    VB Code:
    1. For i = 1 To 50
    2.     a = "c:/windows/desktop/" & b & [B]i[/B] & "/"
    3.     RmDir a
    4. Next i

    Cheers!
    MD5How To Detect Disk In Drive X?Time Tickerchanging the owner of a controlSystray HardCore

    • "Programming is like sex: one mistake and you have to support it for the rest of your life."
    • "A program is a spell cast over a computer, turning input into error messages."
    • "WARNING: Keyboard Not Attached. Press F10 to Continue."
    • "Why doesn't DOS ever say 'EXCELLENT command or filename!'"

  3. #3

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