如何在 VB .NET 中获取列表大小?

发布于 2024-10-03 07:38:28 字数 605 浏览 0 评论 0 原文

我需要在 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”带有蓝色下划线,并且有一个工具提示,内容为:

“未为“公共函数 GetLength(dimension As Integer) As Integer”的参数“dimension”指定参数”。

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

I need to display a list on a ListBox component in VB .NET.

// 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

I'm not familiar with VB .NET and this should be a very simple issue, but I need help!

The code 'resp.itemsList.GetLength' is underlined in blue and there's a tooltip that reads:

"Argument not specified for parameter 'dimension' of 'Public Function GetLength(dimension As Integer) As Integer".

What am I doing wrong here?
Thanks in advance!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

傻比既视感 2024-10-10 07:38:28

有,调用函数Count():

List.Count    

there is, call function Count():

List.Count    
別甾虛僞 2024-10-10 07:38:28

GetLength(0)

尝试来自 rel="nofollow">MSDN 文档

备注

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

Try GetLength(0)

From MSDN documentation:

Remarks

An example of GetLength is
GetLength(0), which returns the number
of elements in the first dimension of
the Array.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文