RaiseEvent

joeKra

Registered User.
Local time
Today, 01:25
Joined
Jan 24, 2012
Messages
208
Hi,
i am trying to get in-Depth information of the RaiseEvent method, i believe it will enhance Building my applications,
i understand so far that it will call a procedure but i don't understand the difference whether just referencing the sub \ function then using RaiseEvent,
any guidance is appreciated,
 
thanks for reply..

still not much helping me, i am trying to figure out the difference from calling a public procedure from a outside module then creating custom event,
please guide me...
thanks forever !
 
This is how I see the difference…

1.
When we Call a Function or Subroutine we are making direct usage of one particular procedure. We Call it using its name.

2.
When we use RaiseEvent we are sending a signal which other procedures listen for.

In 1, we will invoke one procedure directly.
In 2, we may invoke many procedures if they are listening for the event which was raised.

In 1, the procedure must exist, else we get an error.
In 2, the procedure(s) may not exit, at the time, and we will not get an error.

1, is the normal way of Calling a procedure.
2, is more like the broadcast of an event. There may be none, one or many procedures listening for the event to be raised.

In 1, the procedure does not listen for the event, it is Called.
In 2, the procedure(s), if they exist, listen for the event, they are not Called.

Chris.
 
Maybe it's the difference between a push and a pull.

Object B might handle, or sink, an event raised by object A, but in that case object A has no knowledge of object B. This preserves the independence of object A and maximizes its capacity to be reused. But even though object A knows nothing of object B, A can still trigger a process in B if B handles the event. In this case maybe B can be said to "pull" the execution of the code.

If raising events is not possible, then object A must directly call a method of object B, and in that case, A must know something about B and is therefore dependent. This is maybe more of a "push," and if we want object A to work with object C also, then object A must be rewritten which limits it capacity for reuse.

This is the same as Chris' post. His 1) is a push by the object that originates the call. His 2) is a pull by the object that may or may not listen for and sink the event.
 
Yep, push and pull also works for me.

It’s a simple concept for which it is difficult to find the words.

Perhaps the difference could be put as the difference between Instruction and Request.

The Call is the Instruction for a single procedure to follow.
If the Instruction is not done then an error is raised.
It was an Instruction, not a Request.

The RaiseEvent is a Request for any listening procedure to follow.
If there is no procedure listening for the Request then no error is raised.
It was a Request, not an Instruction.

There is a demo here:-
http://www.access-programmers.co.uk/forums/showthread.php?t=206262

Chris.
 

Users who are viewing this thread

Back
Top Bottom