列表框多值检索 [英] list box multivalues retrieval

查看:51
本文介绍了列表框多值检索的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有多选选项=扩展的列表框。


如何将所有选定的值检索到变量/数组变量中


i试过但不能像List4.Value(1)那样..



帮助请


谢谢

I have a List Box with multi-select option = "Extended".

how can i retrieve all the selected values into a variable/array variable

i have tried but cant do like List4.Value(1) ..


help please

Thanks

推荐答案


我有一个带有多选选项=扩展的列表框。

如何将所有选定的值检索到变量/数组变量

i已经尝试但不能像List4.Value(1)..
I have a List Box with multi-select option = "Extended".
how can i retrieve all the selected values into a variable/array variable
i have tried but cant do like List4.Value(1) ..



我相信其中一个属性会返回与列表对应的布尔数组。嗯......我认为该属性被称为 .Selected 。如果是这样,您将使用数组或其他东西来检查 ListBox.Selected( n 。无论如何看看这些属性,你都不应该找到它。

I believe one of the properties returns an array of booleans corresponding to the list. Um... I think the property is called .Selected. If so, you would use an array or something to check ListBox.Selected(n). Have a look through the properties anyway, you shouldn''t have any trouble finding it.


我一直在收到错误:无效使用Null - 只有当我在列表框中选择第一个值时才选择任何值

I am keep on getting error : "Invalid use of Null" - only if i select any value afer the first one in List Box

展开 | 选择 | Wrap | 行号


不确定是否'这是问题所在,但请尝试将第4行更改为对于n = 0到List21.ListCount - 1 。 VB有这种相当恼人的倾向,它将所有数组都设置为零,这意味着它们实际上比你期望的更早结束一个地方。


换句话说,如果列表中有10个项目,它们的实际编号从0到9, 1到10,正如任何合理的人所期望的那样。但ListCount将为10,因为它只是条目数。
Not sure whether it''s the problem, but try changing line 4 to "For n = 0 To List21.ListCount - 1". VB has this rather annoying tendency to begin all its arrays at zero, which means they actually end one place earlier than you expect.

In other words, if there are 10 items in the list, they are actually numbered from 0 to 9, not 1 to 10 as any reasonable person would expect. But the ListCount will be 10, because it''s simply the number of entries.


这篇关于列表框多值检索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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