dcsimg
Results 1 to 6 of 6

Thread: VB.net - Deleted directories remain there plus that they become inaccessible

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2018
    Posts
    428

    VB.net - Deleted directories remain there plus that they become inaccessible

    Hi
    I am creating and deleting some directories via code. Creating is fine, but when I delete them, the the code runs fine (without error) but the directories are still there in Windows explorer (even after refreshing and stuff). When I try to open them, i get a permission denied and you need to be admin etc. Deleting them manually gives the same error.

    Any idea what is going on here?

    code:
    Code:
        
     ' check if the folders needs to be deleted too
                If RemoveFolder = True Then ' delete folders
    
                    Dim DestinationRoot As String = GetScalarValue("SELECT ConfigValue FROM SystemConfiguration WHERE ConfigItem ='Mentor Files'", "Getting the root directory")
    
                    Try
                        System.IO.Directory.Delete(DestinationRoot & "\" & FoldersToDelete, True)
                    Catch ex As Exception
                        MsgBox(ex.Message, MsgBoxStyle.Critical, "Error when deleting folder: " & vbCrLf & vbCrLf & DestinationRoot & "\" & FoldersToDelete)
                        Exit Sub
                    End Try
    
                End If
    Thanks for help.

    Edit:
    I forgot to mention that I can create adn delete folders without problem. I also can manually delete folders that are created through the code.
    Last edited by Grand; Dec 24th, 2019 at 11:35 AM.

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width