Hallo,
ik krijg een error omdat ik niet genoeg toegang heb om door mappen te scannen dit is mijn code
de error is in For Each File In System.IO.Directory.GetFiles(drname, "*", SearchOption.AllDirectories)
en houd in:
System.UnauthorizedAccessException was unhandled by user code
HResult=-2147024891
Message=Access to the path 'C:\$Recycle.Bin\S-1-5-21-1775725311-3999192811-938221265-500' is denied.
Source=mscorlib
StackTrace:
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileSystemEnumerableIterator`1.AddSearchableDirsToStack(SearchData localSearchData)
at System.IO.FileSystemEnumerableIterator`1.MoveNext()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.IO.Directory.GetFiles(String path, String searchPattern, SearchOption searchOption)
at MYAV2._0.Form1.full_DoWork(Object sender, DoWorkEventArgs e) in C:\Users\Jibbe\Downloads\MYAV2.0\MYAV2.0\MYAV2.0\Form1.vb:line 135
at System.ComponentModel.BackgroundWorker.OnDoWork(DoWorkEventArgs e)
at System.ComponentModel.BackgroundWorker.WorkerThreadStart(Object argument)
InnerException:
ik krijg een error omdat ik niet genoeg toegang heb om door mappen te scannen dit is mijn code
Code:
Private Sub full_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles full.DoWork
System.Threading.Thread.Sleep(15000)
Dim drname As String
For Each drive As IO.DriveInfo In IO.DriveInfo.GetDrives
If drive.IsReady Then
drname = drive.Name
For Each File In System.IO.Directory.GetFiles(drname, "*", SearchOption.AllDirectories)
Dim fs As New FileInfo(File)
TextBox4.Text = mdsc(fs.FullName)
TextBox4.Text = shsc(fs.FullName)
Label4.Text = fs.FullName
Label5.Text += 1
If TextBox1.Text.Contains(TextBox4.Text) Then
Label10.Text = fs.FullName
End If
ProgressBar1.Value = Label5.Text
Next
End If
Next
End Sub
de error is in For Each File In System.IO.Directory.GetFiles(drname, "*", SearchOption.AllDirectories)
en houd in:
System.UnauthorizedAccessException was unhandled by user code
HResult=-2147024891
Message=Access to the path 'C:\$Recycle.Bin\S-1-5-21-1775725311-3999192811-938221265-500' is denied.
Source=mscorlib
StackTrace:
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileSystemEnumerableIterator`1.AddSearchableDirsToStack(SearchData localSearchData)
at System.IO.FileSystemEnumerableIterator`1.MoveNext()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.IO.Directory.GetFiles(String path, String searchPattern, SearchOption searchOption)
at MYAV2._0.Form1.full_DoWork(Object sender, DoWorkEventArgs e) in C:\Users\Jibbe\Downloads\MYAV2.0\MYAV2.0\MYAV2.0\Form1.vb:line 135
at System.ComponentModel.BackgroundWorker.OnDoWork(DoWorkEventArgs e)
at System.ComponentModel.BackgroundWorker.WorkerThreadStart(Object argument)
InnerException:
Laatst bewerkt door een moderator: