Virtual Memory - Invalid Result

usvpn

Freshman
Joined
Apr 19, 2010
Messages
45
Hi everyone,
I still have one more problem getting total/available virtual memory, maybe I'm doing something wrong and just wanted to know your professional comments :)
Visual Basic:
Select Case My.Computer.Info.TotalVirtualMemory
    Case Is >= 1073741824
        GetRAMInfo += FormatNumber(My.Computer.Info.TotalVirtualMemory / 1073741824, 0) + " GB" + vbNewLine
    Case 1048576 To 1073741823
        GetRAMInfo += FormatNumber(My.Computer.Info.TotalVirtualMemory / 1048576, 0) + " MB" + vbNewLine
    Case 1024 To 1048575
        GetRAMInfo += FormatNumber(My.Computer.Info.TotalVirtualMemory / 1024, 0) + " KB" + vbNewLine
    Case 0 To 1023
        GetRAMInfo += FormatNumber(My.Computer.Info.TotalVirtualMemory, 0) + " Bytes" + vbNewLine
    Case Else
        GetRAMInfo += "N/A" + vbNewLine
End Select
It's always wrong!
For example, now Windows System Information returns:
Total Virtual Memory = 15.8 GB
Available Virtual Memory = 5.52 GB
While the above code returns:
Virtual Memory: 8,191 GB free of 8,192 GB
(I also use the same above code for My.Computer.Info.AvailableVirtualMemory)
Thanks :)
 
Back
Top