i'm trying to get a given path folders and files but i get the error in the title either "Directory name not valid" or " access refused" and i'm using folderbrowserdialog to select a path
this is the code used
thank you
this is the code used
Code:
Private Sub showfiles(ByVal path As String)
Try
Dim panel As GridPanel = mygrid.PrimaryGrid
panel.Rows.Clear()
mygrid.BeginUpdate()
Dim folders() As String = IO.Directory.GetDirectories(path)
Dim files() As String = IO.Directory.GetFiles(path)
For i As Integer = 0 To folders.Length - 1
Try
If My.Computer.FileSystem.GetDirectoryInfo(folders(i)).Attributes <> IO.FileAttributes.Normal Then
My.Computer.FileSystem.GetDirectoryInfo(folders(i)).Attributes = IO.FileAttributes.Normal
panel.Rows.Add(New GridRow(Format(Now, "HH:mm:ss"), folders(i), "Unhidden"))
Else
panel.Rows.Add(New GridRow(Format(Now, "HH:mm:ss"), folders(i), "Normal"))
End If
showfiles(folders(i))
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Information, "")
Exit Sub
End Try
Next
For i As Integer = 0 To files.Length - 1
Try
If My.Computer.FileSystem.GetFileInfo(files(i)).Attributes <> IO.FileAttributes.Normal Then
My.Computer.FileSystem.GetFileInfo(files(i)).Attributes = IO.FileAttributes.Normal
panel.Rows.Add(New GridRow(Format(Now, "HH:mm:ss"), files(i), "Unhidden"))
Else
panel.Rows.Add(New GridRow(Format(Now, "HH:mm:ss"), files(i), "Normal"))
End If
showfiles(files(i))
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Information, "")
Exit Sub
End Try
Next
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Information, "")
Exit Sub
End Try
mygrid.EndUpdate()
End Sub