Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
 
MSDN Visual Basic Community
 
 
 
 
 
TitleGet the computer's total and available physical and virtual memory in Visual Basic 2005
DescriptionThis example shows how to get the computer's total and available physical and virtual memory in Visual Basic 2005.
Keywordsphysical memory, virtual memory Visual Basic 2005, VB 2005
CategoriesTips and Tricks, VB.NET, Windows
 
Thanks to Josh.

This example makes a new Devices.ComputerInfo object and use its properties to get information about the computer's memory. It also displays the computer's UI culture and operating system information.

Subroutine AddItem adds an item's name and value to a ListView control.

 
Private Sub Form1_Load(ByVal sender As System.Object, ByVal _
    e As System.EventArgs) Handles MyBase.Load
    Dim computer_info As New Devices.ComputerInfo
    AddItem(lvProperties, "InstalledUICulture", _
        computer_info.InstalledUICulture.DisplayName)
    AddItem(lvProperties, "OSFullName", _
        computer_info.OSFullName)
    AddItem(lvProperties, "OSPlatform", _
        computer_info.OSPlatform)
    AddItem(lvProperties, "OSVersion", _
        computer_info.OSVersion)
    AddItem(lvMemory, "AvailablePhysicalMemory", _
        FormatBigBytes(computer_info.AvailablePhysicalMemory, _
        2))
    AddItem(lvMemory, "AvailableVirtualMemory", _
        FormatBigBytes(computer_info.AvailableVirtualMemory, _
        2))
    AddItem(lvMemory, "TotalPhysicalMemory", _
        FormatBigBytes(computer_info.TotalPhysicalMemory, _
        2))
    AddItem(lvMemory, "TotalVirtualMemory", _
        FormatBigBytes(computer_info.TotalVirtualMemory, 2))
End Sub

Private Sub AddItem(ByVal lv As ListView, ByVal item_name _
    As String, ByVal item_value As String)
    Dim lv_item As ListViewItem = lv.Items.Add(item_name)
    lv_item.SubItems.Add(item_value)
End Sub
 
 
Copyright © 1997-2006 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated