Responding to Events using the ActiveX Control on a Visual Basic Form

This sample code could be applied to a form that has a Reflection for UNIX and OpenVMS control. The project should include a reference to the Reflection for UNIX and OpenVMS object library.

When the form loads:

· The Reflection control is configured to connect to a demonstration host

· An event is defined using the OnEvent method. This event triggers the RaiseControlEvent method.

When you display the page and connect to the host (by clicking the connect button), the event procedure uses OnReflectionEvent to display the string data sent from Reflection.


Private Sub UserForm_Initialize()

Set RUD = R2winCtrl1.GetActiveSession

With RUD

'Configure a connection to the demo UNIX host

.ConnectionType = "DEMONSTRATION"

.ConnectionSettings = "Host ""UNIX"""


'Define an event to take place when a connection is made

.OnEvent rcNextEvent, _

rcEvConnected, _

rcVBCommand, _

"RaiseControlEvent 1, ""Connected!"" ", _

rcEnable, _


End With

End Sub


Private Sub R2winCtrl1_OnReflectionEvent(ByVal v1 As Long, ByVal v2 As String)

'Display string value from ReflectionControlEvent

MsgBox v2, , "Reflection"

End Sub