Using the ActiveX Control on a Visual Basic Form

This sample code could be applied to a form that has a Reflection for HP control and a single command button labeled "Connection Setup." The project should include a reference to the Reflection for HP object library.

When the form is loaded, GetActiveSession is used to create a Reflection Session object. The button opens the Connection Setup dialog box.

Private Sub Form_Initialize()

 

'Set the Reflection session type

Set ReflectionHP = R1winCtrl1.GetActiveSession

With ReflectionHP

.ConnectionType = "DEMONSTRATION"

.ConnectionSettings = "Host ""HP 3000"""

End With

End Sub

Private Sub CommandButton2_Click()

'Display the Connection Setup dialog box.

Set ReflectionHP = R1winCtrl1.GetActiveSession

ReflectionHP.ExecuteBuiltInFunction "ConnectionSetup"

End Sub