How do I make a Visual Basic 2008 function only access through events?
I want some event handling functions to be only accessible via raised events and not called from the program.
For example:
Public Event Event1(Byval TheText as string)
private sub Event1Handler(Byval TheText as string) handles me.Event1
msgbox("Hi")
end sub
I want this code to execute a function: RaiseEvent Event1("Hi")
But I don't want this code to do the function: Event1Handler("Hi")
Is there a declaration or some other way to do this?
+2
SteveGSD
source
to share
2 answers
Right click on the function and click Find All Links. Do this periodically to make sure nothing is directly linking to it.
+1
Brian webster
source
to share
There is no other way other than inserting this logic into the lambda expression .
+2
Anton Gogolev
source
to share