Click here to Skip to main content
15,171,576 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have an issue where when i get the count of the number of heaps in a file and i tell the code to read each heap for specific information the first item is duplcated at the end of the items. Now when i tell the code to remove the last list some files i run this on has issues with removing it. if some one could help me find a better way that would be great.

the vaule of strHeaps shows up as a whole number like 41. now the file is 0 based so item one is really item 0 and i think that's where i m having the issue.

VB
Function GetObjectValue(ByVal strProperty1)
    Dim strObject As String = "C:\Temp\ASERVICE.EDM"
    Dim process = GetObject("winmgmts://./root/novadigm:NVD_Agent")
    Dim method = process.Methods_("GetValue")
    Dim inParameters = method.inParameters.SpawnInstance_()
    inParameters.Path = strObject
    Dim outParameters = process.ExecMethod_("NumberOfInstances", inParameters)
    Dim StrHeaps = (outParameters.InstanceCount)
    heap_txt.Text = StrHeaps

    For i = 0 To StrHeaps Step +1

        inParameters.Index = i
        inParameters.Property = strProperty1
        outParameters = process.ExecMethod_("GetValue", inParameters)
        Dim Value1 As String = outParameters.Value

        ListView1.Items.Add(Value1)

    Next

End Function
Posted

1 solution

VB
For i = 0 To StrHeaps Step +1

Should not this loop be till StrHeaps-1 ?
like:
VB
For i = 0 To StrHeaps-1
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900