构建,动态创建控件,事件处理程序 [英] Building, dynamically created controls, Event Handler

查看:51
本文介绍了构建,动态创建控件,事件处理程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好。

如果你帮我的话,我有VBA语法的问题我会非常倾向!


1 - 你能说我吗?声明动态创建的控件(如命令按钮)的事件处理程序以及应用程序必须如何触发它的语法?

2 - 我的应用程序创建一个报表并动态控制它。这个工作的代码是一个名为ReportOptionsSelector的表单的后面,它调用一个函数来创建报表及它的控件。我的问题是我可以声明并构建一个控件的动态创建报表的事件处理程序当前表单源代码或必须做其他任何事情,比如为报表创建动态OnLoad事件并声明报表控件的事件处理程序或类似内容!

非常感谢

Hi guys.
I have tow problems with syntax of VBA if you help me I would be much Obliged!

1-Can you say me the syntax for declaring an Event Handler of a dynamically created control such as a Command Button and how an application must fire it?
2-My application creates a report and it''s controls dynamically.(The code of this job is behind of a form named "ReportOptionsSelector" that calls a function to creating report and it''s controls).My question is can i declare and build a control''s Event handler of my dynamically created report in current Form source code or must doing anything else like creating dynamically OnLoad Event for Report and declare Event Handler of report''s control in it or something similar!
Thanks a lot

推荐答案

@alinagoo


你当然可以做到。请参阅下面的示例。

@alinagoo
You certainly can do it. See example below.

展开 | 选择 | Wrap | 行号


你好


你的代码导致此错误:

>>应用程序无法找到对象''CmdExit_click''。

>>如果''CmdExit_click是新宏或宏组,请确保您已保存并且您已正确键入其名称。


这是我输入的内容:
Hello

Your code caused this Error:
>>Application can''t find the object ''CmdExit_click''.
>>If ''CmdExit_click is new macro or macro group, make sure you have save it and that you have typed its name correctly.

This is what i typed:
展开 | 选择 | Wrap | 行号


@alinagoo


分配给CmdExit.OnClick属性的值应该是字面上的[Event Procedure],正是您在表单设计视图中为其分配的内容。
@alinagoo
The value assigned to CmdExit.OnClick property should be literally "[Event Procedure]", exactly what you assign to it in form design view.


这篇关于构建,动态创建控件,事件处理程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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