none
¿Excepciones súbitas? RRS feed

  • Pregunta

  • Hola, me empezaron a salir excepciones súbitas.

    Excepción:

    System.UnauthorizedAccessException: 'Acceso denegado a la ruta de acceso 'C:\Users\Nathalie\Configuración local'.'

    Texto (sin depurar):

    System.UnauthorizedAccessException: Acceso denegado a la ruta de acceso 'C:\Users\Nathalie\Configuración local'.
       en System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
       en System.IO.FileSystemEnumerableIterator`1.CommonInit()
       en System.IO.DirectoryInfo.InternalGetDirectories(String searchPattern, SearchOption searchOption)
       en _3dspc.Main.Tabs_Selected(Object sender, TabControlEventArgs e)
       en System.Windows.Forms.TabControl.OnSelected(TabControlEventArgs e)
       en System.Windows.Forms.TabControl.WmSelChange()
       en System.Windows.Forms.TabControl.WndProc(Message& m)
       en System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

    El código q menciona ahí es:

    Private Sub Tabs_Selected(sender As Object, e As TabControlEventArgs) Handles Tabs.Selected
            If Tabs.SelectedTab Is TabPage3 Then
                Dim checkpath As String
                If My.Computer.FileSystem.FileExists("games.txt") = True Then
                    Dim titles() As String = File.ReadAllLines("games.txt")
                    checkpath = Environment.GetEnvironmentVariable("USERPROFILE") & "\"
    
                    For Each title As Object In titles
                        If My.Computer.FileSystem.DirectoryExists(checkpath & title) = True Then
                            ListBox1.Items.Add(title)
                        End If
                    Next
                End If
    
                checkpath = Environment.GetEnvironmentVariable("USERPROFILE") & "\" & ListBox1.Text & "\"
                Dim Size As Long = 0
                Dim total As Double
                Dim f As FileInfo
                Dim di As DirectoryInfo = New DirectoryInfo(checkpath)
                di.GetDirectories()
                Dim diarr As DirectoryInfo() = di.GetDirectories()
                Dim fiArr As FileInfo() = di.GetFiles()
    
                For Each di In diarr
    
                    For Each f In fiArr
                        Size = Size + f.Length
                    Next f
    
                    diarr = di.GetDirectories()
                    fiArr = di.GetFiles()
                Next di
                total = Math.Round((Size / 1048576), 0)
            End If
        End Sub

    Pero yo no veo ningún problema...

    Ayuda!!!

    jueves, 24 de agosto de 2017 3:57

Respuestas

Todas las respuestas