InfoConnect for Unisys
Attachmate.Reflection.Framework Namespace / Application Class / CreateControl Method / CreateControl(String) Method
The session path.
Example


In This Topic
    CreateControl(String) Method
    In This Topic
    Creates a control from a saved session file. The method returns a control instantiated from a previously saved session file.
    Syntax
    'Declaration
     
    
    Public Overloads Function CreateControl( _
       ByVal sessionFilePath As String _
    ) As Object
    'Usage
     
    
    Dim instance As Application
    Dim sessionFilePath As String
    Dim value As Object
     
    value = instance.CreateControl(sessionFilePath)
    public object CreateControl( 
       string sessionFilePath
    )

    Parameters

    sessionFilePath
    The session path.

    Return Value

    Created control.
    Exceptions
    ExceptionDescription
    API Service has not been initialized.
    Example
    
    using System;
    using System.Collections.Generic;
    using System.Text;
    using Attachmate.Reflection.Framework;
    using Attachmate.Reflection.Emulation.IbmHosts;
    using Attachmate.Reflection.UserInterface;
    
    namespace OpenASession
    {
        class Program
        {
            static void Main(string[] args)
            {
                //Start a visible instance of InfoConnect or get the instance running at the given channel name
                Application app = MyReflection.CreateApplication("myWorkspace", true);
    
                //Create a terminal from the session document file
                string sessionPath = Environment.GetEnvironmentVariable("USERPROFILE") + @"\Documents\Micro Focus\InfoConnect\gettingStarted.rd3x";
                IIbmTerminal terminal = (IIbmTerminal)app.CreateControl(sessionPath);
    
                //Make the session visible in the workspace
                IFrame frame = (IFrame)app.GetObject("Frame");
                frame.CreateView(terminal);
            }
        }
    }  
                                     
    
                                            
    
    See Also