帮助将项目添加到列表视图 [英] help adding items to a list view

查看:103
本文介绍了帮助将项目添加到列表视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个问题,当我得到文件中堆数的计数,并且告诉代码读取每个堆以获取特定信息时,第一个项目在项目末尾重复.现在,当我告诉代码删除最后一个列表时,我在其上运行的某些文件在删除它时遇到了问题.如果有人可以帮助我找到一种更好的方法,那将是很棒的.

strHeaps的值显示为像41这样的整数.现在文件是基于0的,所以项目1实际上是项目0,我认为这就是我遇到的问题.

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.

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

推荐答案

For i = 0 To StrHeaps Step +1


此循环不应该直到StrHeaps-1吗?
像:


Should not this loop be till StrHeaps-1 ?
like:

For i = 0 To StrHeaps-1


这篇关于帮助将项目添加到列表视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆