|Parameter as Long||A long expression that indicates the index of the parameter being requested ie 0 means the first parameter, 1 means the second, and so on. If -1 is used the EventParam property retrieves the number of parameters. If -2, the EventParam gives full information about the event, such as name, identifier, and parameters. Accessing an not-existing parameter produces an OLE error, such as invalid pointer ( E_POINTER )|
|Variant||A VARIANT expression that specifies the parameter's value.|
Let's take the event "event KeyDown (KeyCode as Integer, ByVal Shift as Integer)", where the KeyCode parameter is passed by reference. For instance, put the KeyCode parameter on 0, and the arrow keys are disabled while the control has the focus.
In most languages you will type something like:
Private Sub Control1_KeyDown(KeyCode As Integer, Shift As Integer) KeyCode = 0 End Sub
In case your environment does not support events with parameters by reference, you can use a code like follows:
Private Sub Control1_KeyDown(KeyCode As Integer, Shift As Integer) Control1.EventParam(0) = 0 End Sub
In other words, the EventParam property provides the parameters of the current event for reading or writing access, even if your environment does not allow changing parameters by reference.
Calling the EventParam property outside of an event produces an OLE error, such as pointer invalid, as its scope was designed to be used only during events.