Looking for Visual Basic help

KM@ Dave

New Member
Reaction score
1
Location
Bournemouth, United Kingdom
Hi all, I've been developing for some time now, and have a few decent Programs out there but I'm stuck in loop for an ongoing bug fix. If you can solve this for me I can fix the bug.

Within my Program I'm calling from WMI, to view WMI references I'm using WMI Code Creator. Below is the code I'm using to call from WMI

Code:
    Private Function Get_RAM_Test() As String
        Dim zRAM = String.Empty
        Try
            Dim WmiSelect As New ManagementObjectSearcher _
            ("root\CIMV2", "SELECT * FROM Win32_PhysicalMemory")
            For Each WmiResults As ManagementObject In WmiSelect.Get()
                zRAM = WmiResults.GetPropertyValue("Capacity").ToString
                If (Not String.IsNullOrEmpty(zRAM)) Then
                    Exit For
                End If
            Next
        Catch err As ManagementException
            MessageBox.Show(err.Message)
        End Try
        Return zRAM
    End Function

And to view the final output I'm using a label and calling the Function name (Get_RAM_Test)

Now the thing is there's more than one stick of RAM and it only shows one stick. Because I'm new to using WMI I don't know how to sort this problem. The bug that occurs is when a LogMeIn mirror driver is installed it shows that, rather than the physical graphics hardware as it's reading from the first line of code in WMI, which is technically correct, but not the Graphics information I need.

Take the RAM for instance WMI Code Creator shows:

Capacity = 2147483648 <First RAM Module
Capacity = 2147483648 <Second RAM Module

My code only shows the 'First RAM Module', sorry for rambling on, I just needed to explain it as much as possible. How can I reference my code to show both the RAM Modules rather than only one.
 
Last edited:
Back
Top