by Gehan Fernando (47 Submissions)
Category: Windows System Services
Compatability: VB.NET
Difficulty: Unknown Difficulty
Originally Published: Sat 11th March 2006
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Get Driver Information Using "MY" Name space In VB.NET
Dim _DCount As Integer = 0
_DCount = My.Computer.FileSystem.Drives.Count
Dim I As Integer = 0
Do While I < (_DCount)
Application.DoEvents()
ListBox1.Items.Add("Name" & vbTab & My.Computer.FileSystem.Drives(I).Name.ToString())
If My.Computer.FileSystem.Drives(I).IsReady = True Then
ListBox1.Items.Add("Type" & vbTab & _
My.Computer.FileSystem.Drives(I).DriveType.ToString())
ListBox1.Items.Add("Format Type" & vbTab & _
My.Computer.FileSystem.Drives(I).DriveFormat.ToString())
ListBox1.Items.Add("Root Directory" & vbTab & _
My.Computer.FileSystem.Drives(I).RootDirectory.ToString())
ListBox1.Items.Add("Label" & vbTab & _
My.Computer.FileSystem.Drives(I).VolumeLabel.ToString())
ListBox1.Items.Add("Total Size" & vbTab & _
(((My.Computer.FileSystem.Drives(I).TotalSize / 1024) / 1024) / 1024).ToString("#,##0.00") & "GB")
ListBox1.Items.Add("Available Free Space" & vbTab & _
(((My.Computer.FileSystem.Drives(I).AvailableFreeSpace / 1024) / 1024) / 1024).ToString("#,##0.00") & "GB")
ListBox1.Items.Add("Total Free Space" & vbTab & _
(((My.Computer.FileSystem.Drives(I).TotalFreeSpace / 1024) / 1024) / 1024).ToString("#,##0.00") & "GB")
Else
ListBox1.Items.Add("Driver Not Ready To Display Informations")
End If
ListBox1.Items.Add("")
I += 1
Loop
Me.Cursor = Cursors.Default