Problema DriveInfo.GetDrives()

giovedì 11 settembre 2014 - 14.33

pieroalampi Profilo | Expert

Salve ho il seguente problema:
sto creando una routine che mi permetta di recuperare le unità della mia macchina con il seguente codice

Imports System.IO

'Ottengo le untià drive
Dim allDrives() As DriveInfo = DriveInfo.GetDrives()
Dim d As DriveInfo
For Each d In allDrives
If d.IsReady = True Then
CmbUnita.Items.Add(d.Name.ToUpper)
End If
Next

ala scrittura del codice Dim allDrives() As DriveInfo = DriveInfo.GetDrives()
esattamente su DriveInfo.GetDrives()
il compilatore mi dice che DriveInfo :
Impossibile convertire il valore di tipo 'GestLaundry.DriveInfo' in 'Matrice a 1 dimensioni di GestLaundry.DriveInfo'.
qualcuno sa il perché???
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
LA PRIMA FRASE DI UN PROGRAMMATORE HELLO WORD ...... ANCHE L'ULTIMA

0v3rCl0ck Profilo | Guru

secondo me hai definito una classe nel tuo progetto che si chiama esattamente DriveInfo e va in conflitto con il tipo dato del framework, prova a riscrivere la riga così:

Dim allDrives() As System.IO.DriveInfo = DriveInfo.GetDrives()



Michael Denny | Visual C# MVP
http://blogs.dotnethell.it/Regulator/
http://dennymichael.wordpress.com
http://mvp.microsoft.com/mvp/Michael%20Denny-5000735
Twitter: @dennymic

pieroalampi Profilo | Expert

no niente non era quello il problema, ho scoperto di avere delle modifiche in unaclassUsbDrivers.vb grazie comunqque
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
LA PRIMA FRASE DI UN PROGRAMMATORE HELLO WORD ...... ANCHE L'ULTIMA

0v3rCl0ck Profilo | Guru

ok meglio così

alla prossima


Michael Denny | Visual C# MVP
http://blogs.dotnethell.it/Regulator/
http://dennymichael.wordpress.com
http://mvp.microsoft.com/mvp/Michael%20Denny-5000735
Twitter: @dennymic

pieroalampi Profilo | Expert

grazie
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
LA PRIMA FRASE DI UN PROGRAMMATORE HELLO WORD ...... ANCHE L'ULTIMA
Partecipa anche tu! Registrati!
Hai bisogno di aiuto ?
Perchè non ti registri subito?

Dopo esserti registrato potrai chiedere
aiuto sul nostro Forum oppure aiutare gli altri

Consulta le Stanze disponibili.

Registrati ora !
Copyright © dotNetHell.it 2002-2025
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5