J
Joe Sulla
This is not a programming question.
I want to know how many bytes there are in one gigbyte.
I have a computer with 1G RAM.
ControlPanel System shows 1G
TotalPhysicalMemory returns the total amount of physical memory for the
computer.
On my machine TotalPhysicalMemory returns 1072689152
But 1024 * 1024 * 1024 = 1073741824
Does the number 1072689152 make any sense for a 1G machine?
Thanks
BACKGROUND INFO
When I run the program below I get 1023MB
Not 1G
Because NumBytes is les than 1024 * 1024 * 1024
Dim NumBytes As ULong = My.Computer.Info.TotalPhysicalMemory
Select Case NumBytes
Case Is < 1024
Return Format(CInt(NumBytes), "###,###,###,###,##0 bytes")
'CInt rounds
Case Is < 1024 * 1024
Return Format(CInt(NumBytes / 1024), "###,###,###,##0 KB")
Case Is < 1024 * 1024 * 1024
Return Format(CInt(NumBytes / 1024 / 1024), "###,###,##0
MB")
Case Else
Return Format(CInt(NumBytes / 1024 / 1024 / 1024), "#,###.00
GB")
End Select
I want to know how many bytes there are in one gigbyte.
I have a computer with 1G RAM.
ControlPanel System shows 1G
TotalPhysicalMemory returns the total amount of physical memory for the
computer.
On my machine TotalPhysicalMemory returns 1072689152
But 1024 * 1024 * 1024 = 1073741824
Does the number 1072689152 make any sense for a 1G machine?
Thanks
BACKGROUND INFO
When I run the program below I get 1023MB
Not 1G
Because NumBytes is les than 1024 * 1024 * 1024
Dim NumBytes As ULong = My.Computer.Info.TotalPhysicalMemory
Select Case NumBytes
Case Is < 1024
Return Format(CInt(NumBytes), "###,###,###,###,##0 bytes")
'CInt rounds
Case Is < 1024 * 1024
Return Format(CInt(NumBytes / 1024), "###,###,###,##0 KB")
Case Is < 1024 * 1024 * 1024
Return Format(CInt(NumBytes / 1024 / 1024), "###,###,##0
MB")
Case Else
Return Format(CInt(NumBytes / 1024 / 1024 / 1024), "#,###.00
GB")
End Select