Using the ActiveX Control on a Visual Basic Form

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

When the form is loaded, GetActiveSession is used to create a Reflection Session object. This object is used to configure a 5250 session. Commented out code shows how you could accomplish the same thing with the control's Command method. A button on the page uses the Command method to display the Session Setup dialog box. Commented out code shows how you could accomplish the same thing with GetActiveSession. (Click here to see a list of other dialog box commands used by Reflection.)

Private Sub Form_Initialize()

 

'Set the Reflection session type

 

'Technique #1: Create a Reflection Session Object

Set Ribm = RibmCtrl1.GetActiveSession

Ribm.SetupSession rc5250Terminal, rc31792, rcTelnet

 

'Technique #2: Use the control's Command method

'RibmCtrl1.Command ".SetupSession rc5250Terminal, rc31792, rcTelnet"

 

End Sub

Private Sub Command1_Click()

'Display the SessionSetup dialog box.

RibmCtrl1.Command ".SessionSetupDlg"

 

'Alternative syntax to do this using the Reflection object

'Resume if user cancels the dialog box

'On Error Resume Next

'Set Ribm = RibmCtrl1.GetActiveSession

'Ribm.SessionSetupDlg

End Sub