Okay so I found some code on the internet to work with(using X360.dll by DJ Shepard), and It basically just got the names of the drives and I edited the code so it gets the name of the drives into a tree node. So now, I have 2 tree views, and treeview 2 is for the folders and files of the drive(partriton) from treeview1. So I have the code for the drives in treeview1 working, but for the folders, I get an error. Anyone have any suggestions or fixes for the error?
My Code:
Code:
Imports X360.FATX
Imports X360.IO
Imports X360
Imports X360.FATX.FATXManagement
Public Class explorer
Private Sub ShowDrivesToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles ShowDrivesToolStripMenuItem.Click
Dim Drives As New List(Of FATXDrive)()
Dim DeviceReturns As DeviceReturn() = X360.FATX.FATXManagement.GetFATXDrives(10)
For Each DeviceReturn As DeviceReturn In DeviceReturns
Drives.Add(New FATXDrive(DeviceReturn))
Next
For Each Drive As FATXDrive In Drives.ToArray()
TreeView1.Nodes.Add(Drive.DriveName)
Next
Dim FATXDrives As FATXDrive() = Drives.ToArray()
Dim Partitions As FATXPartition() = Drives(0).Partitions
Dim Files As FATXFileEntry() = Partitions(0).Files
Dim Folders As FATXFolderEntry() = Partitions(0).Folders
For Each folder As FATXFolderEntry In Partition(TreeView1.SelectedNode)
TreeView2.Nodes.Add(folder.Name)
Next
End Sub