Program to find the Total Virtual Memory of the computer using

Posted by Rajnilari2015 under VB.NET category on | Points: 40 | Views : 745
Imports Microsoft.VisualBasic.Devices

Namespace ConsoleApplication2
Class Program
Private Shared Sub Main(args As String())
Dim CI As New ComputerInfo()

'get total virtual memory
Dim totalVirtualMemory = ((CI.TotalVirtualMemory / (1024 * 1024)) * 0.001 + " GB").ToString()

Console.WriteLine("The total virtual memory is {0}", totalVirtualMemory)


End Sub
End Class
End Namespace

First of all, we need to add the reference to Microsoft.VisualBasic assembly. The property TotalPhysicalMemory, gets the total amount of physical memory for the computer. It returns a ULong containing the number of bytes of physical memory for the computer.Now we are first converting the value to Mega bytes(MB) and hence performing CI.TotalPhysicalMemory / (1024 * 1024). Once we obtain the result in Mega bytes(MB), we are converting the same to Giga bytes(GB).We know that
1 MB = 0.001 GB . And hence, is the result.

Comments or Responses

Login to post response