My.Computer ( checking RAM & HD )

kb2tfa

New member
Joined
Jan 10, 2008
Messages
4
Programming Experience
1-3
Hi all,

I am trying to write a program that will check the RAM size and the Hard Drive Free space.

This is what I have so far.
I think this gives me the RAM, not sure. It results in 527,822,848 and the RAM
installed on the pc is 504M

MessageBox.Show(My.Computer.Info.TotalPhysicalMemory.ToString(Format("###,###,###,###,###,###")))

This is what I think is the Hard Drive but I'm not sure.

MessageBox.Show(My.Computer.FileSystem.Drives(0).AvailableFreeSpace.ToString(Format("###,###,###,###,###,###")))

I get 12,354,420,736, and the Hard Drive is 34.2G and the free space is 11.5G

Does any of this look right.
 
Last edited:
Remember:
1,024 Byte = 1 Kilobyte (KB)
1,024 Kilobyte (KB) = 1 Megabyte (MB)
1,024 Megabyte (MB) = 1 Gigabyte (GB)
therefore: 1,073,741,824 Bytes = 1 Gigabyte (GB) (1024 * 1024 * 1024)


So by displaying 11.5Gb as free, when you work it out in bytes you actually have 12348030976 (11.5 * 1073741824) - yours may be slightly different because the 11.5 may be rounded up or down ;)

If you want to display total size, use the total size command!
MessageBox.Show(My.Computer.FileSystem.Drives(0).TotalSize.ToString)

If you want to show the free space left, that's
MessageBox.Show(My.Computer.FileSystem.Drives(0).AvailableSize.ToString)

^^ that will show you in bytes anyway, there is no need to format unless you desperately want the commas to be included....
 
Last edited:
Thank You Very Much

Thanks again for the reply. You helped a lot.

I am trying to check if the computer is suffering on resources.
 
Last edited:
Back
Top