Quackers Posted June 26, 2008 Posted June 26, 2008 How do you get vb.net to read the figure that is displayed when you right click on a drive and do properties, under free space? We can get free space of a drive, but its slighly different to the figure displayed there. Was wondering if there is some code to just read the figure from there.
mattmoo Posted July 16, 2008 Posted July 16, 2008 Can you tell us the two amounts? is one dividing by 1000 for bits and the other by 1024 for bits? it can change the size dramatically on large drives. Give more details and we will see
TornUp Posted July 16, 2008 Posted July 16, 2008 wellll. this is weird!!! i have just been building an application for work that does this... you will need to add: Imports System.IO then this is how iv done mine.. Dim alldrives() As DriveInfo = DriveInfo.GetDrives 'setting up the main function for getting drive infomation Dim a_total = Format(alldrives(10).TotalSize / 1024 / 1024 / 1024, "#0.0") Dim a_freespace = Format(alldrives(10).TotalFreeSpace / 1024 / 1024 / 1024, "#0.0") Label6.Text = a_total & " GB" 'total HDD Size Label5.Text = a_freespace & " GB" 'Free space 'A nice progress bar! ProgressBar1.Maximum = a_total ProgressBar1.Minimum = 0 ProgressBar1.Value = a_freespace the progress bar is set up how i like it, but you might want it diffrent.. let me explain.. lets use an example HDD size of 100GB and 80GB free if you have ProgressBar1.Value set as: ProgressBar1.Value = a_freespace It will fill the progress bar 80% but. if you have: ProgressBar1.Value = a_total - a_freespace it will fill the progress bar with used amount. so will only fill it 20% OOOO! i forgot! you change what drive you are getting the infomation from with: from: alldrives(NUMBER HERE) it takes a bit of playing about. but i found out, if you step through it. (and then over it, so its loaded the infomation into that VAR) then you can hover over the where alldrive() is defined and it will give you a list of drives and there ID number.. any more problems. give me a shout.. but thats what i use. and it works niceely
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now