| | |
Need code to get free space and used space in hard drive ..
Please support our VB.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Dec 2002
Posts: 461
Reputation:
Solved Threads: 56
Try this:
VB.NET Syntax (Toggle Plain Text)
Dim dvr As New DriveInfo("c:") Label1.Text = CStr(dvr.TotalFreeSpace / 1000000) & " MB" Label2.Text = CStr(dvr.TotalSize / 1000000) & " MB" Label3.Text = CStr(Val(Label2.Text) - Val(Label1.Text)) & " MB"
Last edited by waynespangler; Sep 19th, 2007 at 11:09 am.
Wayne
It is hard to understand how a cemetery can raise its burial rates and blame it on the cost of living.
It is hard to understand how a cemetery can raise its burial rates and blame it on the cost of living.
This is slightly modified from the VB 2005 .NET help files. lstInfo is a listbox in my test application.
VB.NET Syntax (Toggle Plain Text)
Dim alldrives() As DriveInfo = DriveInfo.GetDrives() Dim d As DriveInfo For Each d In alldrives lstInfo.Items.Add(String.Format( _ "Drive {0}", d.Name)) lstInfo.Items.Add(String.Format( _ " File type: {0}", d.DriveType)) If d.IsReady = True Then lstInfo.Items.Add(String.Format( _ " Volume label: {0}", d.VolumeLabel)) lstInfo.Items.Add(String.Format( _ " File system: {0}", d.DriveFormat)) lstInfo.Items.Add(String.Format( _ " Available space to current user:{0, 12:N0} Mbytes", _ d.AvailableFreeSpace >> 20)) lstInfo.Items.Add(String.Format( _ " Total available space: {0, 12:N0} Mbytes", _ d.TotalFreeSpace >> 20)) lstInfo.Items.Add(String.Format( _ " Total size of drive: {0, 12:N0} Mbytes ", _ d.TotalSize >> 20)) End If Next
![]() |
Similar Threads
- Hard drive real caoacity (Windows NT / 2000 / XP)
- Not enough space on hard drive to burn CD? (Windows NT / 2000 / XP)
- Move window XP PRO to new Hard drive (Windows NT / 2000 / XP)
Other Threads in the VB.NET Forum
- Previous Thread: help in save/load database
- Next Thread: save data to access database
| Thread Tools | Search this Thread |
.net .net2008 2005 2008 access account arithmetic array basic bing browser button buttons center check code combobox crystalreport cuesent data database datagrid datagridview date datetimepicker dissertation dissertations dissertationtopic dropdownlist excel fade file-dialog filter ftp generatetags google gridview hardcopy images input insert intel internet listview mobile monitor ms net networking objects output panel passingparameters pdf picturebox picturebox1 port position print printing problem project read remove save searchbox searchvb.net select serial settings shutdown soap survey table tcp temperature text textbox timer timespan toolbox transparency trim update user vb vb.net vb.netformclosing()eventpictureboxmessagebox vb2008 vbnet view visual visualbasic visualbasic.net visualstudio visualstudio2008 web winforms wpf year





