Exposing sub outside form

  • Thread starter Thread starter John
  • Start date Start date
John,

Make it from private public, be aware however that you are violating direct
all rules of OOP than,.

Cor
 
just declare it

Public Sub Foo()

End Sub

and anything can see it. Hope this helps

--Jon
 
try this

Friend sub mysub
end sub


the keywords "Protected Friend" allows any code within the application
namespace to access the sub

But if you want any code including those outside your project you may want
to try
Public instead of "Protected Friend"
 
Cor Ligthert said:
John,

Make it from private public, be aware however that you are violating
direct all rules of OOP than,.

Cor

Cor,

Simply making a private sub public doesn't violate OOP. You are allowed
to extend and republish a published interface and it won't break existing
code. Going the other way could break existing code. In addition, a sub
doesn't return anything, so unless there are byref arguments, no information
about the internal structure and state of the form object can be returned,
making it impossible for violation of encapsulation.

Mike
 
Michael,

(and now the true one).

You are right, however I don't like all those public member to do this kind
of things (and I am violating to it as needed).

Cor
 
Back
Top