+ Post New Thread
Results 1 to 3 of 3
Coding Thread, VB.net get free space in Coding and Web Development; How do you get vb.net to read the figure that is displayed when you right click on a drive and ...
  1. #1
    Quackers's Avatar
    Join Date
    Jan 2006
    Thank Post
    Thanked 160 Times in 135 Posts
    Rep Power

    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.

  2. #2
    mattmoo's Avatar
    Join Date
    Jun 2008
    Thank Post
    Thanked 8 Times in 7 Posts
    Rep Power
    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

  3. #3

    Join Date
    Feb 2008
    Stevenage, Hertfordshire
    Thank Post
    Thanked 8 Times in 5 Posts
    Rep Power
    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

    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:

    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

+ Post New Thread

Similar Threads

  1. Replies: 4
    Last Post: 17th November 2009, 09:58 AM
  2. [SOLVED] Vista Free Space doesn't make sense
    By link470 in forum Windows Vista
    Replies: 4
    Last Post: 7th July 2008, 11:37 PM
  3. Running out of space
    By ricki in forum Wireless Networks
    Replies: 1
    Last Post: 13th May 2008, 10:49 AM
  4. Free free space wipe tool needed asap!
    By tech_guy in forum Windows
    Replies: 5
    Last Post: 28th February 2008, 04:56 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts