【问题标题】:how to get a list size em VB .NET?如何获得列表大小 em VB .NET?
【发布时间】:2011-05-12 00:49:12
【问题描述】:

我需要在 VB .NET 中的 ListBox 组件上显示一个列表。

// params is a string representing a path, empty means root folder
params.itemsPath = ""

// resp is a response object, here it is a String[]
resp = myAPI.browseTags(params)

Dim listSize As Integer
listSize = resp.itemsList.GetLength

Dim i As Integer
For i = 0 To listSize
    ListBox1.Items.Add(resp.itemsList(i).itemName)
Next

我不熟悉 VB .NET,这应该是一个非常简单的问题,但我需要帮助!

代码“resp.itemsList.GetLength”带有蓝色下划线,并且有一个工具提示:

“没有为'Public Function GetLength(dimension As Integer) As Integer”的参数'dimension'指定参数。

我在这里做错了什么? 提前致谢!

【问题讨论】:

    标签: list listbox size vb.net-2010


    【解决方案1】:

    有,调用函数Count():

    List.Count    
    

    【讨论】:

      【解决方案2】:

      试试GetLength(0)

      来自MSDN documentation

      备注

      GetLength 的一个例子是 GetLength(0),返回数字 的第一维中的元素 数组。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-05-15
        • 1970-01-01
        • 2018-03-07
        • 2013-10-24
        • 1970-01-01
        相关资源
        最近更新 更多