Guest User

Guest User

  • Tech Writer
  • 115
  • 21.8k

Special Folder vb.net

Nov 25 2017 12:39 PM
I guys! 'm tring to search specific file(xlsx) into my document folder, but i get error about permission.I set the vb.net ication as Administrator
 
Thanks for any help!
 
My code:
 
Dim FolderPath As String = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)
Dim directory = FolderPath
Dim files() As System.IO.FileInfo
Dim dirinfo As New System.IO.DirectoryInfo(directory)
files = dirinfo.GetFiles("xlsx", IO.SearchOption.AllDirectories) error line:
 
Eccezione non gestita di tipo 'System.UnauthorizedAccessException' in mscorlib.dll
 
For Each file In files
ListBox1.Items.Add(file)
Next
End Sub

Answers (1)