Program to find the Available Virtual Memory of the computer using

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

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

'get total memory
Dim availableVirtualMemory = ((CI.AvailableVirtualMemory / (1024 * 1024)) * 0.001 + " GB").ToString()

Console.WriteLine("The available virtual memory is {0}", availableVirtualMemory)


End Sub
End Class
End Namespace

First of all, we need to add the reference to Microsoft.VisualBasic assembly. The property AvailableVirtualMemory, gets the total amount of computer's free virtual address space. It returns a ULong containing the number of bytes of the computer's free virtual address space.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