开发者

Calling Functions across the project

Are there any functions that can be called across the project.

I mean we cn use Private Sub ABC() function in开发者_如何学Go the document where it has been declared but is there any way that this could be called from any other form?

Thanks

Furqan


You could consider adding a Shared tag in your Sub method.


You could mark it Friend rather than Private, and then use the InternalsVisibleTo attribute to give access to other projects.


In VB, this is typically done via a Module. It can also be done using a Shared Public/Friend accessor (in which case you have to access it using class.method instead of instance.method).

Modules are basically singletons, and that is disliked by some, and can cause problems when refactoring.


No, you can't call Private Sub declared in a class by another class. Use Public Sub instead.


To call the abc function from form2 you need to 2 things

1.) make function as shared

2.) create an object of form1 in form2 then call by using the object

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜