循环通过表单上的控件组 [英] Looping through groups of controls on a form

查看:107
本文介绍了循环通过表单上的控件组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Access 2010,我正在尝试对控件进行分组,以便我可以将组中的每个控件的属性编辑为一个。我目前正在使用控件的标签属性来指定它所属的组,然后我循环调用控件并根据其标签属性将其添加到集合(通过类模块)。但是,这意味着如果我想在表单中添加一个组,我必须编辑我的代码以引用我的类模块的另一个实例,然后测试新组。是否有办法使我的代码更通用,而不必为每个表单复制我的代码,然后编辑代码以适应该表单上的组数?我在想它需要一个循环,但我不知道该循环什么。这就是我现在正在使用的内容。

I''m using Access 2010 and I''m trying to group controls so that I can edit each control''s properties in a group as one. I am currently using the control''s tag property to specify which group it is apart of and then I loop through call the controls and add it to a collection (through a class module) based on its tag property. However, this means that if I want to add a group to the form, I have to edit my code to reference another instance of my class module and then test for the new group. Is there a way to make it so that my code could be more universal instead of having to duplicate my code for each form and then edit the code to fit the number of groups on that form? I''m thinking it would need a loop, but I don''t know what to loop through. Here is what I''m using now.

展开 | 选择 | Wrap | 行号

推荐答案

使用clsControl的集合。
Use a collection of clsControl.
展开 | 选择 | Wrap | 行号


如何获取唯一标记值? SELECT DISTINCT函数是否可用于所有标记值?
How do I get the unique tag values? Is there a SELECT DISTINCT function available for all of the tag values?


不,您只需循环查看是否已添加该标记值。
No, you just loop through and check whether or not you''ve already added that one.


这篇关于循环通过表单上的控件组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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