本文介绍了在运行时通过字符串名称(动态)调用方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要迭代一组控件并设置事件处理程序

使用给定控件的名称作为基础。伪代码

(wishful-thinkingcode!):


AddHandler BufControl.validateevent,AddressOf

TheMagicalFunctionThatTurnsAStringIntoAMethod(BufC ontrol.Name& ;_Validate)


假设BufControl = txtAdd1,我要找的替代输出是*:


AddHandler txtAdd1.ValidateEvent, AddressOf txtAdd1_Validate


''TheMagicalFunction ...'的真实姓名是什么,好吗?我前几天刚看到一个帖子

但我没有机会找到它,因为我不知道任何

合法关键字!


谢谢! =)


------------

(*是的,我意识到这段代码永远不会真正出现在源文件中。 -

i只是将它列为最终输出''应该表现得像''的一个例子。

i need to iterate through a collection of controls and set event handlers
using the given control''s name as a basis. in pseudocode
(wishful-thinkingcode!):

AddHandler BufControl.validateevent, AddressOf
TheMagicalFunctionThatTurnsAStringIntoAMethod(BufC ontrol.Name & "_Validate")

assume BufControl = txtAdd1, the substituted output i am looking for is*:

AddHandler txtAdd1.ValidateEvent, AddressOf txtAdd1_Validate

what is the real name of ''TheMagicalFunction...'', please? i just saw a post
on this the other day but i have no chance of finding it as i don''t know any
legitimate keywords!

THANKS! =)

------------
(*yes, i realize this code would never actually appear in the source file. -
i just list it as an example of what the final output ''should behave like'')

推荐答案







这篇关于在运行时通过字符串名称(动态)调用方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-12 06:12