在整个项目中调用函数. [英] Calling Functions across the project.

查看:78
本文介绍了在整个项目中调用函数.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


在整个项目中是否可以调用任何功能.
我的意思是我们在声明了它的文档中使用cn Private Sub ABC()函数,但是有没有办法以其他任何形式调用它呢?
谢谢
Furqan

[edit]进行编辑以提高可读性-losmac [/edit]

Hi,
Are there any functions that can be called across the project.
I mean we cn use Private Sub ABC() function in the document where it has been declared but is there any way that this could be called from any other form?
Thanks
Furqan

[edit]Edited for more readible - losmac[/edit]

推荐答案

您有4种方法可以做到:
1)编写您的课程
2)使用界面 [代理人 [Form1.ABC()/not recomended/这样调用它.
You have 4 ways to do it:
1) write your class
2) use interfaces[^]
3) use delegates[^]
One of these 3 methods are recomended.
or
4) change visibility of your function removing word "Private", then call it like Form1.ABC() /not recomended/.


您可以使用单例类,通过该类您可以拥有一个实例可以包含此功能.
You could use a singleton class using which you can have a single instance that can contain this function.


这篇关于在整个项目中调用函数.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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