Welcome, Register for free! or Login below:
EduGeek.net RSS Feeds Register FAQ Members Social Groups User Map Calendar Search Today's Posts Mark Forums Read

Go Back   EduGeek.net Forums > Coding and Web Development > Coding
Reply
 
LinkBack Thread Tools Search Thread Language
Sponsored Links
Old 26-06-2008, 11:04 AM   #1
 
Quackers's Avatar
 
Join Date: Jan 2006
Location: Staffordshire
Posts: 538
uk
Thanks: 2
Thanked 19 Times in 15 Posts
Rep Power: 10 Quackers will become famous soon enough
Send a message via MSN to Quackers
Default VB.net get free space

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.
  Reply With Quote
Old 16-07-2008, 10:36 AM   #2
 
mattmoo's Avatar
 
Join Date: Jun 2008
Posts: 14
uk
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0 mattmoo is an unknown quantity at this point
Default

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
  Reply With Quote
Old 16-07-2008, 01:56 PM   #3
 
Tom-Kirby's Avatar
 
Join Date: Feb 2008
Location: Stevenage, Hertfordshire
Posts: 81
uk
Thanks: 0
Thanked 2 Times in 1 Post
Rep Power: 2 Tom-Kirby is on a distinguished road
Default

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..

Code:
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
  Reply With Quote
Reply

Register now for FREE and post messages!


Username: Password: Confirm Password: E-Mail: Confirm E-Mail:
Birthday:      
Image Verification
  I agree to forum rules 

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Vista Free Space doesn't make sense link470 Windows Vista 4 07-07-2008 10:37 PM
Running out of space ricki Networks 1 13-05-2008 09:49 AM
Free free space wipe tool needed asap! tech_guy Windows 5 28-02-2008 04:56 PM
Space Shuttle is on its way to the International Space Stati tickmike General Chat 2 12-12-2006 01:56 PM



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search Thread
Search Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT +1. The time now is 01:50 AM.
Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 ©2008, Crawlability, Inc.
Copyright EduGeek.net