列表框中每个项目的运行功能 [英] Running function for each item in listbox

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

问题描述

您好,


我确定这是一个简单的问题我甚至不想打扰发帖但是对于我的生活我只是不能让它工作:(


我有一个按钮切换全选和选择无。每当用户点击无时,它会运行一个清除的功能一系列数据,同样当他们点击全部时,它输入一长串数据。只要用户实际点击每个项目,该功能就可以工作,但是如果有100多个条目的列表框,用户将不会点击每个单元单独lol


我正在使用的全选代码非常标准:

Hello,

I''m sure this is such a simple question I didn''t even want to bother posting but for the life of me I just can''t get it to work : (

I have a button that toggles "Select All" and "Select None". Whenever the user clicks "None" it runs a function that clears a series of data and likewise when they click "All" it inputs a long series of data. The function works as long as the user actually CLICKS each item, however with a listbox of 100+ entries the users will not be clicking each unit individually lol

The "Select All" code that I''m using is very standard:

展开 | 选择 | Wrap | 行号

推荐答案


您好,


我确定这是一个如此简单的问题,我甚至不想打扰发帖,但对于我的生活,我不能让它工作:(


我有一个切换全选的按钮和选择无。每当用户点击无时它运行一个清除一系列数据的功能,同样当它们点击全部时也是如此。它输入了一系列数据。只要用户实际点击每个项目,该功能就可以工作,但是如果有一个100多个条目的列表框,用户将不会单独点击每个单元lol


全选我正在使用的代码非常标准:


对于intcounter = 0到SelectionLst.ListCount

InputGoodies

SelectionLst。 Selected(intcounter)= True

Next intcounter


函数InputGoodies需要像我运行OnClick for listbox那样运行。我的点击同样简单:


如果SelectionLst.Selected(SelectionLst.ListIndex)=" -1"然后

InputGoodies

否则

...


有什么方法可以做某种循环,它将为ListCount中的每个项目执行上述功能?我不明白为什么我不能上班,我觉得我已经尝试了一切。帮助完全赞赏!! :D $ />

-Cathy
Hello,

I''m sure this is such a simple question I didn''t even want to bother posting but for the life of me I just can''t get it to work : (

I have a button that toggles "Select All" and "Select None". Whenever the user clicks "None" it runs a function that clears a series of data and likewise when they click "All" it inputs a long series of data. The function works as long as the user actually CLICKS each item, however with a listbox of 100+ entries the users will not be clicking each unit individually lol

The "Select All" code that I''m using is very standard:

For intcounter = 0 To SelectionLst.ListCount
InputGoodies
SelectionLst.Selected(intcounter) = True
Next intcounter

The function "InputGoodies" needs to run the way it would if I ran it OnClick for the listbox. My on-click is just as simple:

If SelectionLst.Selected(SelectionLst.ListIndex) = "-1" Then
InputGoodies
Else
...

Is there any way to make some kind of loop that will do the above function for each item in the ListCount? I don''t understand why I can''t get it to work, I feel like I''ve tried everything. Help is completely appreciated!! : D

-Cathy



Cathy,我对你的要求有点模糊。假设您的列表框名称是List1,以下代码将列表框(List1)中的每个值传递给SomeValue()函数,在那里它将以某种方式进行调整或操作。列表框中的所有条目都将传递给函数,无论它们是否被选中。这是你要找的吗?

Cathy, I''m a little hazy on exactly what you are requesting. Assuming your List Box name is List1, the following code will pass each value in the List Box (List1) to the SomeValue() Function, where it will be adjusted or operated on in some manner. ALL entries in the List Box will be passed to the Function regardless of whether they are selected or not. Is this what you are looking for?

展开 | 选择 | Wrap | 行号



...

全选我正在使用的代码非常标准:
...
The "Select All" code that I''m using is very standard:
展开 | 选择 | Wrap | 行号


我尝试了两个建议,但我仍然可以'不能让它工作:(


我正在引用的InputGoodies功能如下所示:

Well I tried both of the suggestions but I still can''t get this to work : (

The "InputGoodies" function that I''m referencing looks like this:

展开 | 选择 | Wrap | 行号


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

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