将项目添加到多列列表框中 [英] Add items to a multi-column List Box

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

问题描述

有人可以给我一个简单的示例,说明如何向vbscript中的多列列表框添加值. 例如,我有4列,我想添加一行.

Can someone please give me a simple example of how to add values to a multi-column listbox in vbscript. For example I have 4 columns and I'd like to add a row.

http://msdn. microsoft.com/en-us/library/office/ff869962%28v=office.15%29.aspx 我尝试了这个示例,但它一直告诉我找不到成员.List.

http://msdn.microsoft.com/en-us/library/office/ff869962%28v=office.15%29.aspx I tried this example but it kept telling me that it could not find the member .List.

我在MS Access中使用vbscript.我有一个带有列表框的表单.我想用我拥有的文本框值填充此列表框,这样当我单击添加"时,文本框中的值将添加到列表框的特定列下.

I am using vbscript in MS Access. I have a form with a listbox. I want to populate this listbox with the textbox values I have such that when I click on Add, the values in the textboxes are added to the listbox under their particular column.

我一直没有用-我没有找到一个可行的示例,或者至少我缺少一些导入信息?

I have been searching to no avail - I haven't found one example that works or at least am I missing some import?

推荐答案

我记得我已经做过一次,来到了这个解决方案:

I remember I have done this once and came to this solution:

Private Sub test()
    Me.lboTest.RowSourceType = "Value List"
    Me.lboTest.BoundColumn = 1
    Me.lboTest.ColumnCount = 2
    Me.lboTest.RowSource = "0;red;1;green;2;yellow;3;blue"
End Sub

事先将字符串与;组装在一起(或读取并附加值,然后将其写回).
我不知道还有没有其他办法.

Assemble the string beforehand with ; (or read it and append values, then write it back).
I don't know if there is any other way.

顺便说一句,只是为了确保您理解正确:VBA和VBScript是不同的东西.如果您在Access本身中编写此代码,则说明您使用的是VBA,而不是VBScript.

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

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