
Originally Posted by
mo3ad001
that nice But why As DriveInfo ??
[php]For Each drive
As DriveInfo In My.Computer.FileSystem.Drives
For Each N As String In [/php]
It's error ...
and i can Remove it Right ?
it's work Perfect

but have some lag

Drive Info is need for getting drive properties. In this case, we used its name.

Originally Posted by
mo3ad001
and i want just For C Drive ?
how ?
Just check whether the current drive is "C:" :
Code:
For Each drive As DriveInfo In My.Computer.FileSystem.Drives
If drive.Name.startswith("C") Then
For Each N As String In My.Computer.FileSystem.GetDirectories(drive.Name)
Try
For Each x As String In My.Computer.FileSystem.GetFiles(N, FileIO.SearchOption.SearchAllSubDirectories, "*.*")
Application.DoEvents()
ListBox1.Items.Add(x)
Next
Catch ex As Exception
Continue For
End Try
End If
Next
Next