I have been trying to find code that either retrieves all drive information about every drive, or just retrieves the drive letter ( such as the 'C' in 'C:\' or the whole 'C:\' ). All the information I have found is written for VB5 or VB6, which does not work with Visual Studio 2005 SE. Here is what I have so far, which retrives the data from a .txt file created by the user:
vb
Dim fileDrive As String
fileDrive = My.Computer.FileSystem.ReadAllText("C:\Program Files\ArchAN\Drive.txt")
Dim drive As System.IO.DriveInfo
drive = My.Computer.FileSystem.GetDriveInfo(fileDrive & ":\")
Dim space As Long = drive.AvailableFreeSpace
Dim fileSize As String
fileSize = My.Computer.FileSystem.ReadAllText("C:\Program Files\ArchAN\Space.txt")
Dim temp As Decimal
temp = (space / 1024 / 1024 / 1000)
If temp < fileSize Then
temp = Format(temp, "#,###.##")
Me.tmrCheck.Enabled = False
MessageBox.Show("Attention: the " & fileDrive & ":\ is getting full." & vbNewLine & "It is recomended that you archive older files to conserve space." & vbNewLine & vbNewLine & "space remaining: " & temp & " GB", "", MessageBoxButtons.OK, MessageBoxIcon.Warning)
NotifyIcon1.Visible = False
End
End If
I would like the program to retrieve the information from the computer automatically. After that, I can use the data anyway I want.
Any help would be great.
thanks,
--Ian